Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A44] Getting current Directory with allegro

This thread is locked; no one can reply to it. rss feed Print
[A44] Getting current Directory with allegro
larienna
Member #3,185
January 2003
avatar

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.

Enjoy! and have fun

Elias
Member #358
May 2000

--
"Either help out or stop whining" - Evert

Thomas Fjellstrom
Member #476
June 2000
avatar

He's asking about allegro 4.4

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Audric
Member #907
January 2001

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
Member #3,185
January 2003
avatar

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?

Enjoy! and have fun

Audric
Member #907
January 2001

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

Thomas Fjellstrom
Member #476
June 2000
avatar

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.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Aikei_c
Member #14,871
January 2013
avatar

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
Member #14,740
November 2012

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

Go to: