diff options
Diffstat (limited to 'drivers/windows/file_access_windows.cpp')
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 3f27068fb2..36dcab1d67 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -124,7 +124,16 @@ void FileAccessWindows::close() { bool rename_error; + +#ifdef WINRT_ENABLED + // WinRT has no PathFileExists, so we check attributes instead + DWORD fileAttr; + + fileAttr = GetFileAttributesW(save_path.c_str()); + if (INVALID_FILE_ATTRIBUTES == fileAttr) { +#else if (!PathFileExistsW(save_path.c_str())) { +#endif //creating new file rename_error = _wrename((save_path+".tmp").c_str(),save_path.c_str())!=0; } else { @@ -139,7 +148,6 @@ void FileAccessWindows::close() { ERR_FAIL_COND( rename_error ); } - } bool FileAccessWindows::is_open() const { |