This commit is contained in:
Branimir Karadžić
2018-02-02 21:50:23 -08:00
parent f3bda773b0
commit 8f9b407745

View File

@@ -8,15 +8,17 @@
#include <bx/os.h>
#include <bx/readerwriter.h>
#include <stdio.h> // remove
#include <dirent.h> // opendir
#if !BX_CRT_NONE
# include <stdio.h> // remove
# include <dirent.h> // opendir
#if BX_CRT_MSVC
# include <direct.h> // _getcwd
#else
# include <sys/stat.h> // mkdir
# include <unistd.h> // getcwd
#endif // BX_CRT_MSVC
# if BX_CRT_MSVC
# include <direct.h> // _getcwd
# else
# include <sys/stat.h> // mkdir
# include <unistd.h> // getcwd
# endif // BX_CRT_MSVC
#endif // 0
#if BX_PLATFORM_WINDOWS
extern "C" __declspec(dllimport) unsigned long __stdcall GetTempPathA(unsigned long _max, char* _ptr);
@@ -174,7 +176,8 @@ namespace bx
{
#if BX_PLATFORM_PS4 \
|| BX_PLATFORM_XBOXONE \
|| BX_PLATFORM_WINRT
|| BX_PLATFORM_WINRT \
|| BX_CRT_NONE
BX_UNUSED(_buffer, _size);
return NULL;
#elif BX_CRT_MSVC
@@ -409,6 +412,9 @@ namespace bx
int32_t result = ::_mkdir(_filePath.get() );
#elif BX_CRT_MINGW
int32_t result = ::mkdir(_filePath.get());
#elif BX_CRT_NONE
BX_UNUSED(_filePath);
int32_t result = -1;
#else
int32_t result = ::mkdir(_filePath.get(), 0700);
#endif // BX_CRT_MSVC
@@ -483,6 +489,9 @@ namespace bx
result = ::remove(_filePath.get() );
}
}
#elif BX_CRT_NONE
BX_UNUSED(_filePath);
int32_t result = -1;
#else
int32_t result = ::remove(_filePath.get() );
#endif // BX_CRT_MSVC
@@ -521,7 +530,12 @@ namespace bx
return false;
}
#if BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
#if BX_CRT_NONE
BX_UNUSED(_filePath);
return false;
#elif BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_OSX
DIR* dir = opendir(_filePath.get() );
if (NULL == dir)
{
@@ -547,7 +561,7 @@ namespace bx
}
closedir(dir);
#endif // BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX || BX_PLATFORM_OSX
#endif // !BX_CRT_NONE
return remove(_filePath, _err);
}