File paths on different platforms

BlitzMax Forums/BlitzMax Beginners Area/File paths on different platforms

RexRhino(Posted 2004) [#1]
Since file paths are normally specified differently on different platforms, how do we to specify a file path in a OS neutral way?


FlameDuck(Posted 2004) [#2]
I believe the / character will work on all platforms.

As for "C:" vs. "/" I don't think there's a way (at least not one I've stumbled accross), but I would say that it's safe to assume that as long as you use relative pathnames you should be in the clear.

I know my stuff works from both "D:\Dev\BlitzMAX" and "/home/FlameDuck/Dev/BlitzMAX".


Hotcakes(Posted 2004) [#3]
What about ../ does that work on anything but Windows?


RexRhino(Posted 2004) [#4]
Toby... I haven't tried it in Blitz for Linux, but I have used the same thing in php, python, on a linux system, so I would assume that is a safe bet!


Robert(Posted 2004) [#5]
For relative paths, you can use / in both Windows and other platforms.


FlameDuck(Posted 2004) [#6]
What about ../ does that work on anything but Windows?
I can confirm this works on Linux, and I believe James once said it worked on Mac too (it should anyhoo, because the filesystem is similar - to Linux that is).


Hotcakes(Posted 2004) [#7]
Good. That's everything you need for relative paths then, innit? ;]


Perturbatio(Posted 2004) [#8]
../ should work in windows as well