Branimir Karadžić 7 gadi atpakaļ
vecāks
revīzija
8f9b407745
1 mainītis faili ar 26 papildinājumiem un 12 dzēšanām
  1. 26 12
      src/filepath.cpp

+ 26 - 12
src/filepath.cpp

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