1
0

Moved cMakeDir::MakeDir to cFile::CreateFolder.

And exported to Lua.
This commit is contained in:
madmaxoft
2013-10-09 09:57:48 +02:00
parent 2ff882f239
commit 55999ee118
12 changed files with 66 additions and 70 deletions

View File

@@ -310,11 +310,11 @@ bool cFile::Copy(const AString & a_SrcFileName, const AString & a_DstFileName)
bool cFile::IsFolder(const AString & a_Path)
{
#ifdef _WIN32
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & FILE_ATTRIBUTE_DIRECTORY) != 0));
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & FILE_ATTRIBUTE_DIRECTORY) != 0));
#else
struct stat st;
return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode));
struct stat st;
return ((stat(a_Path.c_str(), &st) == 0) && S_ISDIR(st.st_mode));
#endif
}
@@ -325,11 +325,11 @@ bool cFile::IsFolder(const AString & a_Path)
bool cFile::IsFile(const AString & a_Path)
{
#ifdef _WIN32
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0));
DWORD FileAttrib = GetFileAttributes(a_Path.c_str());
return ((FileAttrib != INVALID_FILE_ATTRIBUTES) && ((FileAttrib & (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_DEVICE)) == 0));
#else
struct stat st;
return ((stat(a_Path.c_str(), &st) == 0) && S_ISREG(st.st_mode));
struct stat st;
return ((stat(a_Path.c_str(), &st) == 0) && S_ISREG(st.st_mode));
#endif
}
@@ -351,6 +351,19 @@ int cFile::GetSize(const AString & a_FileName)
bool cFile::CreateFolder(const AString & a_FolderPath)
{
#ifdef _WIN32
return (CreateDirectory(a_FolderPath.c_str(), NULL) != 0);
#else
return (mkdir(a_FolderPath.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0);
#endif
}
int cFile::Printf(const char * a_Fmt, ...)
{
AString buf;