Standard file path delimiter constant #PATHDELIM$ for PB ?
Posted: Wed Mar 31, 2004 8:28 pm
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
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