1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-07-03 06:24:32 +00:00

replace CreateDirA() and mkdir() scattered everywhere by createDir() with some more error checking.

This commit is contained in:
fgenesis 2013-11-14 20:07:39 +01:00
parent 7de589e275
commit ab752e1156
5 changed files with 47 additions and 27 deletions

View file

@ -1170,6 +1170,38 @@ void triggerBreakpoint()
#endif
}
bool createDir(const std::string& d)
{
bool success = false;
int err = 0;
#if defined(BBGE_BUILD_UNIX)
if (!mkdir(d.c_str(), S_IRWXU))
success = true;
else
{
err = errno;
if (err == EEXIST)
success = true;
}
#elif defined(BBGE_BUILD_WINDOWS)
if (CreateDirectoryA(d.c_str(), NULL))
success = true;
else
{
err = GetLastError();
if(err == ERROR_ALREADY_EXISTS)
success = true;
}
#endif
if (!success)
{
std::ostringstream os;
os << "Failed to create directory: [" << d << "], error code: " << err;
debugLog(os.str());
}
return success;
}
#include "DeflateCompressor.h"