Does allegro offers a cross platform way to get the current directory?
I found getcwd, but apparently, it's not cross platform. I found this thread that tried to do so:
http://stackoverflow.com/questions/2868680/what-is-a-cross-platform-way-to-get-the-current-directory
Not sure if it really works.
He's asking about allegro 4.4
getcwd is extremely cross-platform. I know only two mostly-POSIX compilers that don't implement it:
- The C compiler used on Atari MiNT
- Microsoft compilers...
Oh! so it's more compiler dependent than platform dependent?
So I could use getcwd if I compile a windows app with gcc, but not msvc?
Yep. Write your code on Mingw-gcc, and almost everything will work on other systems.
It's more dependent on the runtime libc library. msvcrt is missing a lot of things, and some are there, but have an underscore prepended.
It's pretty much just to make porting programs harder.
Microsoft compilers
getcwd does seem to be implemented and actually works at least in my visual studio 2012. The header for it is direct.h.
When you don't use VS getcwd doesn't need direct.h. Maybe it derives from winallegro. But I can't tell for sure.