aboutsummaryrefslogtreecommitdiff
path: root/drivers/windows/file_access_windows.cpp
diff options
context:
space:
mode:
authorGeorge Marques2016-09-03 19:36:44 -0300
committerGeorge Marques2016-09-03 19:36:44 -0300
commitc9b82498b4b8de7b5f4c19873421d32ca1749ed2 (patch)
tree0eb93a7f5534ae6ca54b7d31a274653bce806f71 /drivers/windows/file_access_windows.cpp
parent2eaad1cfd1c96538d7aaf8bbd46535f8a143d2ad (diff)
downloadgodot-c9b82498b4b8de7b5f4c19873421d32ca1749ed2.tar.gz
godot-c9b82498b4b8de7b5f4c19873421d32ca1749ed2.tar.zst
godot-c9b82498b4b8de7b5f4c19873421d32ca1749ed2.zip
Diffstat (limited to 'drivers/windows/file_access_windows.cpp')
-rw-r--r--drivers/windows/file_access_windows.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 3f27068fb..36dcab1d6 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 {