summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/file_access_windows.cpp22
-rw-r--r--drivers/windows/file_access_windows.h4
-rw-r--r--drivers/windows/mutex_windows.h4
-rw-r--r--drivers/windows/semaphore_windows.h4
-rw-r--r--drivers/windows/thread_windows.h4
5 files changed, 14 insertions, 24 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp
index 646e744248..fb21c0c5a1 100644
--- a/drivers/windows/file_access_windows.cpp
+++ b/drivers/windows/file_access_windows.cpp
@@ -38,6 +38,7 @@
#include <shlwapi.h>
#include <windows.h>
+#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <tchar.h>
@@ -114,17 +115,25 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) {
path = path + ".tmp";
}
- _wfopen_s(&f, path.c_str(), mode_string);
+ errno_t errcode = _wfopen_s(&f, path.c_str(), mode_string);
if (f == NULL) {
- last_error = ERR_FILE_CANT_OPEN;
- return ERR_FILE_CANT_OPEN;
+ switch (errcode) {
+ case ENOENT: {
+ last_error = ERR_FILE_NOT_FOUND;
+ } break;
+ default: {
+ last_error = ERR_FILE_CANT_OPEN;
+ } break;
+ }
+ return last_error;
} else {
last_error = OK;
flags = p_mode_flags;
return OK;
}
}
+
void FileAccessWindows::close() {
if (!f)
@@ -167,13 +176,11 @@ void FileAccessWindows::close() {
if (close_fail_notify) {
close_fail_notify(save_path);
}
-
- ERR_EXPLAIN("Safe save failed. This may be a permissions problem, but also may happen because you are running a paranoid antivirus. If this is the case, please switch to Windows Defender or disable the 'safe save' option in editor settings. This makes it work, but increases the risk of file corruption in a crash.");
}
save_path = "";
- ERR_FAIL_COND(rename_error);
+ ERR_FAIL_COND_MSG(rename_error, "Safe save failed. This may be a permissions problem, but also may happen because you are running a paranoid antivirus. If this is the case, please switch to Windows Defender or disable the 'safe save' option in editor settings. This makes it work, but increases the risk of file corruption in a crash.");
}
}
@@ -334,8 +341,7 @@ uint64_t FileAccessWindows::_get_modified_time(const String &p_file) {
return st.st_mtime;
} else {
- ERR_EXPLAIN("Failed to get modified time for: " + file);
- ERR_FAIL_V(0);
+ ERR_FAIL_V_MSG(0, "Failed to get modified time for: " + file + ".");
}
}
diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h
index 2848ed5279..e7f9fc690d 100644
--- a/drivers/windows/file_access_windows.h
+++ b/drivers/windows/file_access_windows.h
@@ -38,10 +38,6 @@
#include <stdio.h>
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class FileAccessWindows : public FileAccess {
FILE *f;
diff --git a/drivers/windows/mutex_windows.h b/drivers/windows/mutex_windows.h
index 6d3b641a26..582d26029c 100644
--- a/drivers/windows/mutex_windows.h
+++ b/drivers/windows/mutex_windows.h
@@ -37,10 +37,6 @@
#include <windows.h>
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class MutexWindows : public Mutex {
#ifdef WINDOWS_USE_MUTEX
diff --git a/drivers/windows/semaphore_windows.h b/drivers/windows/semaphore_windows.h
index 8adeffbb7f..cfd33d033a 100644
--- a/drivers/windows/semaphore_windows.h
+++ b/drivers/windows/semaphore_windows.h
@@ -37,10 +37,6 @@
#include <windows.h>
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class SemaphoreWindows : public Semaphore {
mutable HANDLE semaphore;
diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h
index a74d4e46f3..b47452838c 100644
--- a/drivers/windows/thread_windows.h
+++ b/drivers/windows/thread_windows.h
@@ -38,10 +38,6 @@
#include <windows.h>
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
class ThreadWindows : public Thread {
ThreadCreateCallback callback;