Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Creating directory in A5 for Linux and Windows

This thread is locked; no one can reply to it. rss feed Print
Creating directory in A5 for Linux and Windows
PeKaGM
Member #15,654
June 2014

Hi. I'm creating program in which I use funkction "mkdir" for creating directories. In Linux it must look like - mkdir(name_of_dir,0777) - and for Windows just
- mkdir(name_of_dir). How ca I made one source code that will compile in both systems with mkdir ? Now I have to change mkdir syntax when I want to compile for Win or Linux and therefore have two source codes. Or is other way to create directory which will be the same for both systems? Thanks for answers.

Thomas Fjellstrom
Member #476
June 2000
avatar

you could try al_make_directory. If you must use mkdir, you can use ifdef's to pick which mkdir to use.

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

Gideon Weems
Member #3,925
October 2003

Don't forget al_get_standard_path. For good examples of its usage, see "framework.c" from the skater demo and Todd Cope's 2014 SpeedHack entry.

Edit: Why no link?

pkrcel
Member #14,001
February 2012

I guess the autolink works only in <code> tags?

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Thomas Fjellstrom
Member #476
June 2000
avatar

Some functions may not be in matthew's api database? My best guess.

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

Edgar Reynaldo
Member #8,592
May 2007
avatar

pkrcel
Member #14,001
February 2012

al_get_standard_path vs. al_get_standard_path

just as I say two posts above

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Thomas Fjellstrom
Member #476
June 2000
avatar

Well, yeah. it doens't work in pre tags. the auto linking is part of the syntax highlighting. Also try `this type of code tag`

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

Gideon Weems
Member #3,925
October 2003

Thanks, guys. I was thinking that code tags like al_get_standard_path refused to be inline for some reason.

Go to: