From 59a1e105b6f5dc4600c8bdc24b32499e135df73c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 8 Oct 2026 09:44:11 -0700 Subject: [PATCH] Fixed WinRT build. (#450) --- src/file.cpp | 30 ++++++++++++++++++++++++++++++ src/filepath.cpp | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/file.cpp b/src/file.cpp index 82158c1..2273446 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -851,6 +851,23 @@ namespace bx return false; } + if (0 != (st.st_mode & _S_IFREG) ) + { + _outFileInfo.type = FileType::File; + } + else if (0 != (st.st_mode & _S_IFDIR) ) + { + _outFileInfo.type = FileType::Dir; + } +# elif BX_CRT_MSVC + struct ::_stat64 st; + int32_t result = ::_stat64(_filePath.getCPtr(), &st); + + if (0 != result) + { + return false; + } + if (0 != (st.st_mode & _S_IFREG) ) { _outFileInfo.type = FileType::File; @@ -898,6 +915,8 @@ namespace bx ? ::_wmkdir(filePath) : -1 ; +#elif BX_CRT_MSVC + int32_t result = ::_mkdir(_filePath.getCPtr() ); #elif BX_CRT_NONE BX_UNUSED(_filePath); int32_t result = -1; @@ -974,6 +993,17 @@ namespace bx : ::_wremove(filePath) ; } +#elif BX_CRT_MSVC + int32_t result = -1; + FileInfo fi; + + if (stat(fi, _filePath) ) + { + result = FileType::Dir == fi.type + ? ::_rmdir(_filePath.getCPtr() ) + : ::remove(_filePath.getCPtr() ) + ; + } #elif BX_CRT_NONE BX_UNUSED(_filePath); int32_t result = -1; diff --git a/src/filepath.cpp b/src/filepath.cpp index ec1fce6..e2339cb 100644 --- a/src/filepath.cpp +++ b/src/filepath.cpp @@ -10,7 +10,7 @@ #if BX_PLATFORM_WINDOWS # include // _wgetcwd -#else +#elif !BX_CRT_MSVC # include // getcwd #endif // BX_PLATFORM_WINDOWS