Wrong Path? (was Bug? Not sure)

Linux specific forum
RSrole
User
User
Posts: 71
Joined: Fri Apr 29, 2022 8:27 pm

Wrong Path? (was Bug? Not sure)

Post by RSrole »

I'm not sure if this is a Purebasic bug, Linux bug or Russ bug but here's the problem:

I have a program that I wrote in windows. When I made the desktop shortcut the "Start In" is "C:\PureBasic Projects\InfoPad" and the
"Target" is "C:\PureBasic Projects\InfoPad\InfoPad64.exe". In the code I have a line Global db$ = GetCurrentDirectory() + "InfoPad.db3"

Everything works as I expected and if I look at db$ it is "C:\PureBasic Projects\InfoPad\InfoPad.db3". So far, so good.

When I compile and run in Raspberry Pi Linux, all works well when the program is started (now called "InfoPad") in "/home/rsrole/Private/Purebasic Projects/InfoPad"
but when started from the launcher, the GetCurrentDirectory() points to "/home/rsrole/InfoPad.db3"

Here' the InfoPad.desktop file:

[Desktop Entry]
Type=Application
Comment=InfoPad
Name=InfoPad
Path="/home/rsrole/Private/Purebasic Projects/InfoPad"
Exec="/home/rsrole/Private/Purebasic Projects/InfoPad/InfoPad"
Terminal=false
#gnome-panel-launcher
Type=Application
NoDisplay=false
StartupNotify=true

Did I make the launcher incorrectly? Or is this a bug?

// Moved from "Bugs - Linux" to "Linux" (Kiffi)
User avatar
moulder61
Enthusiast
Enthusiast
Posts: 188
Joined: Sun Sep 19, 2021 6:16 pm
Location: U.K.

Re: Bug? Not sure

Post by moulder61 »

Hi Russ,

I think you might need to escape the space in the path with a backslash? I'm pretty sure Linux doesn't allow spaces in path names.

Exec="/home/rsrole/Private/Purebasic\ Projects/InfoPad/InfoPad"

Moulder.
"If it ain't broke, fix it until it is!

This message is brought to you thanks to SenselessComments.com

My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
User avatar
mk-soft
Always Here
Always Here
Posts: 6202
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Bug? Not sure

Post by mk-soft »

Code: Select all

Global db$ = GetCurrentDirectory() + "InfoPad.db3"
At the start of the program you never know exactly which one the OS will return.
If the DB is in the program directory (Windows prevents writing to the program directory)
better

Code: Select all

GetPathPart(ProgramFilename())
Copy this to the User folder for editing ...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
RSrole
User
User
Posts: 71
Joined: Fri Apr 29, 2022 8:27 pm

Re: Bug? Not sure

Post by RSrole »

Linux does allow spaces in path name (or so I found out), but you have to enclose the full path in quotes or it will hate you :lol:

MK, your trick worked like a charm.

Thanks to both of you for your replies. Always appreciated
Russ
User avatar
Kiffi
Addict
Addict
Posts: 1484
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Wrong Path? (was Bug? Not sure)

Post by Kiffi »

<OT>

Two more hints (not only for you, RSrole):

1.: If you are not sure whether it is a bug or not, do not post it in the bug forum. If it turns out to be a bug, the moderators will promptly move it to the appropriate forum.

2.: Please use meaningful subjects in future.

Thank you

</OT>
Hygge
User avatar
Piero
Addict
Addict
Posts: 863
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Wrong Path? (was Bug? Not sure)

Post by Piero »

viewtopic.php?p=643242#p643242

I knew it: future reference :wink: :mrgreen:

PS: see QuoteString
Post Reply