From 8f9b407745ac25d3ed06f0243764daf4dd85e0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 2 Feb 2018 21:50:23 -0800 Subject: [PATCH] Cleanup. --- src/filepath.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/filepath.cpp b/src/filepath.cpp index 1fb2c48..215ec4b 100644 --- a/src/filepath.cpp +++ b/src/filepath.cpp @@ -8,15 +8,17 @@ #include #include -#include // remove -#include // opendir +#if !BX_CRT_NONE +# include // remove +# include // opendir -#if BX_CRT_MSVC -# include // _getcwd -#else -# include // mkdir -# include // getcwd -#endif // BX_CRT_MSVC +# if BX_CRT_MSVC +# include // _getcwd +# else +# include // mkdir +# include // 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); }