aboutsummaryrefslogtreecommitdiff
path: root/drivers/windows/dir_access_windows.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2014-06-11 10:41:43 -0300
committerJuan Linietsky2014-06-11 10:41:43 -0300
commit64e83bfd1404ea593f0c79b478d196a3fcde42a8 (patch)
treec18c61da239443532a94fb9fa54df702df12a90b /drivers/windows/dir_access_windows.cpp
parent9b8696d3dd92e2ed6f310ad0f0bf3c2182c9c6ae (diff)
parent5f5cd5e6d1508f85ac1bffa44e122b4dc0e2bb1d (diff)
downloadgodot-64e83bfd1404ea593f0c79b478d196a3fcde42a8.tar.gz
godot-64e83bfd1404ea593f0c79b478d196a3fcde42a8.tar.zst
godot-64e83bfd1404ea593f0c79b478d196a3fcde42a8.zip
Diffstat (limited to 'drivers/windows/dir_access_windows.cpp')
-rw-r--r--drivers/windows/dir_access_windows.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index 30f6ff6d8..aacd02ca2 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -303,6 +303,39 @@ bool DirAccessWindows::file_exists(String p_file) {
return false;
}
+bool DirAccessWindows::dir_exists(String p_dir) {
+
+ GLOBAL_LOCK_FUNCTION
+
+ if (!p_dir.is_abs_path())
+ p_dir=get_current_dir()+"/"+p_dir;
+ p_dir=fix_path(p_dir);
+
+ p_dir.replace("/","\\");
+
+ if (unicode) {
+
+ DWORD fileAttr;
+
+ fileAttr = GetFileAttributesW(p_dir.c_str());
+ if (0xFFFFFFFF == fileAttr)
+ return false;
+
+ return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+
+ } else {
+ DWORD fileAttr;
+
+ fileAttr = GetFileAttributesA(p_dir.ascii().get_data());
+ if (0xFFFFFFFF == fileAttr)
+ return false;
+ return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+
+ }
+
+ return false;
+}
+
Error DirAccessWindows::rename(String p_path,String p_new_path) {
p_path=fix_path(p_path);