[A44] Getting current Directory with allegro
larienna

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.

Elias
Thomas Fjellstrom

He's asking about allegro 4.4

Audric

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...

larienna

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?

Audric

Yep. Write your code on Mingw-gcc, and almost everything will work on other systems.

Thomas Fjellstrom

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.

Aikei_c
Audric said:

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.

#00JMP00

When you don't use VS getcwd doesn't need direct.h. Maybe it derives from winallegro. But I can't tell for sure.

Thread #613931. Printed from Allegro.cc