Wasn't going to create a new post for this but then I thought since it was a different topic I probably should:
I wanted to drop a note about something I noticed tonight when I was working. There is an inconsistency with the documentation and the actual way the libary works in the filesystem code.
According to both the manual on A.cc and at docs.liballeg.org, al_make_directory should:
Creates a new directory on the filesystem. This function also creates any parent directories as needed.
Returns true on success (including if the directory already exists), otherwise returns false on error. Fills in Allegro's errno to indicate the error.
However, the following code shows that if the directory already exists, the function will return false rather than true. This caused me quite some trouble today before I actually thought of testing for the true return value. Was this changed a while back?
I was using this code to return false on a file saving routine:
After finding out about the true return values, I had to change that code to this:
Also, since the data directory already exists, when the monsters directory did not, this command failed every time as well:
I assume this is because al_make_directory tries to make the parent directories as well, and since it is returning false because data already exists, it does not create the monsters directory.
Just wanted to mention that in case it wasn't an intentional change.