behaviour of fileinfo windows v.s. linux

Started by handsource-dyko, January 30, 2011, 02:11:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

handsource-dyko

I've noticed that under windows, a "\" is added at the end of the path. So when I add the fileinfo.path and fileinfo.name strings together I get "C:\bennu\test\test1.prg".
under linux this would result int to "/home/pieter/bennu/testtest1.prg", so I need to add a "/", obviously it should be "/home/pieter/bennu/test/test1.prg"

Because fileinfo.path under windows is  "C:\bennu\test\" and under linux it is "/home/pieter/bennu/test" Why does this behave differently? I've found out after a lot of
frustation with my latest creation, a bennu based file selection dialog box.

Is it just a platform specific thing? There is nothing about this different behaviour on the wiki.

Also, how is the behaviour under other operation systems like macos/haiku os/gpwiz/caanoo? I suspect a linux like behaviour, thinking
windows is different from the rest.

FreeYourMind

You never must use '\' in a path, this is compatible only with windows. Use always '/' and you don't have problems in any SO.

handsource-dyko

I suppose that "/" is the posix compatibe way? Anyway, it works now. Another windows oddity though, are drive letters. On linux or unix style os's this handled in a much more elegant way, namely that drives are mounted in the main tree. Only for windows I have to add extra code for drive selection, even though under the hood, modern windows versions also seem to use this sceme, but still maintain the antiquated drive letter concept! (At least for users, windows xp is supposed to be posix compatibe).

josebita

I believe most OSes use linux-like file-system scheme. Anyway, just to be sure, always use "/" as foldeer separator and if in doubt, it won't hurt to have double slashes. I mean that when generating paths programmatically, using a path like:
/home/joseba/mygame//myfile.png
will work just fine, so always add a slash, if in doubt.