Page 1 of 1

Wrong Path? (was Bug? Not sure)

Posted: Mon Jul 14, 2025 5:04 pm
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)

Re: Bug? Not sure

Posted: Mon Jul 14, 2025 5:33 pm
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.

Re: Bug? Not sure

Posted: Mon Jul 14, 2025 9:09 pm
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 ...

Re: Bug? Not sure

Posted: Mon Jul 14, 2025 10:28 pm
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

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

Posted: Mon Jul 14, 2025 10:51 pm
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>

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

Posted: Sat Jul 19, 2025 2:16 pm
by Piero
viewtopic.php?p=643242#p643242

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

PS: see QuoteString