Page 1 of 1

Standard file path delimiter constant #PATHDELIM$ for PB ?

Posted: Wed Mar 31, 2004 8:28 pm
by USCode
How about a standard PB constant of #PATHDELIM$ ?

I try to only write code that is cross-platform. If I ever need to build a file path string, then I could use this PB constant and not have to worry about which platform I'm compiling on.

For example,
On Linux -
#PATHDELIM$ = "/"

On Windows -
#PATHDELIM$ = "\"

On OS X -
#PATHDELIM$ = "/" (MacOS 8 & 9 used ":", OS X allows both)

On Amiga -
#PATHDELIM$ = "/" (is this correct?)

But in code we just use #PATHDELIM$, and so it would be correct for whichever platform we're compiling on:

MyPathString = "HOME" + #PATHDELIM$ + "BACKUP" + #PATHDELIM$ + MyFileName

Or maybe a constant like this already exists???
Thanks,
Brian

Posted: Wed Mar 31, 2004 8:47 pm
by GPI
Better Solution:

All PB-Comand should take both ("/" and "\") and convert it automatically to OS-Default.

And a new Command: ConvertPathToOSDefault(Path$).

Edit: BTW: Windows should take both!

Automatic would be nice and superior solution but...

Posted: Wed Mar 31, 2004 8:56 pm
by USCode
...I like the simplicity of just a platform-specific constant. Besides, there's a better chance of getting this in, it would be a very simple change.

Re: Standard file path delimiter constant #PATHDELIM$ for PB

Posted: Thu Apr 01, 2004 5:31 am
by PB
> maybe a constant like this already exists???

viewtopic.php?t=8187

Just put the correct delimiter in for each CompilerCase command.

Posted: Wed Apr 07, 2004 1:49 am
by USCode
Just put the correct delimiter in for each CompilerCase command.
A simple constant would be much simpler.