summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-17 10:44:51 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-09-17 10:44:51 -0300
commit7de53cf242fb83718e511599e95300eadad16157 (patch)
tree7ba4f569732c927c2de545caf870427f7ee00bbf
parent87af69b14dde7f51cfddbd8f2451728fbf4c5c40 (diff)
parent034aec2539f50f3943581c30fdf3eff3e66f7532 (diff)
Merge pull request #574 from marynate/PR-fix-change-dir
Fixed DirAccessWindows::change_dir not working properly;
-rw-r--r--drivers/windows/dir_access_windows.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index e07c9bb354..cac04b68c3 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -189,9 +189,10 @@ Error DirAccessWindows::change_dir(String p_dir) {
current_dir=real_current_dir_name; // TODO, utf8 parser
current_dir=current_dir.replace("\\","/");
- }
+ } else {
- SetCurrentDirectoryW(prev_dir.c_str());
+ SetCurrentDirectoryW(prev_dir.c_str());
+ }
return worked?OK:ERR_INVALID_PARAMETER;
} else {
@@ -209,9 +210,10 @@ Error DirAccessWindows::change_dir(String p_dir) {
current_dir=real_current_dir_name; // TODO, utf8 parser
current_dir=current_dir.replace("\\","/");
- }
+ } else {
- SetCurrentDirectoryA(prev_dir.ascii().get_data());
+ SetCurrentDirectoryA(prev_dir.ascii().get_data());
+ }
return worked?OK:ERR_INVALID_PARAMETER;
@@ -299,8 +301,9 @@ bool DirAccessWindows::file_exists(String p_file) {
GLOBAL_LOCK_FUNCTION
- if (!p_file.is_abs_path())
- p_file=get_current_dir()+"/"+p_file;
+ if (!p_file.is_abs_path())
+ p_file=get_current_dir()+"/"+p_file;
+
p_file=fix_path(p_file);
p_file.replace("/","\\");
@@ -309,21 +312,22 @@ bool DirAccessWindows::file_exists(String p_file) {
if (unicode) {
- DWORD fileAttr;
+ DWORD fileAttr;
fileAttr = GetFileAttributesExW(p_file.c_str(), GetFileExInfoStandard, &fileInfo);
if (0xFFFFFFFF == fileAttr)
return false;
- return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+ return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
} else {
- DWORD fileAttr;
+ DWORD fileAttr;
fileAttr = GetFileAttributesExA(p_file.ascii().get_data(), GetFileExInfoStandard, &fileInfo);
if (0xFFFFFFFF == fileAttr)
return false;
- return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
+
+ return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
}
@@ -334,8 +338,9 @@ bool DirAccessWindows::dir_exists(String p_dir) {
GLOBAL_LOCK_FUNCTION
- if (!p_dir.is_abs_path())
- p_dir=get_current_dir()+"/"+p_dir;
+ if (!p_dir.is_abs_path())
+ p_dir=get_current_dir()+"/"+p_dir;
+
p_dir=fix_path(p_dir);
p_dir.replace("/","\\");
@@ -344,7 +349,7 @@ bool DirAccessWindows::dir_exists(String p_dir) {
if (unicode) {
- DWORD fileAttr;
+ DWORD fileAttr;
fileAttr = GetFileAttributesExW(p_dir.c_str(), GetFileExInfoStandard, &fileInfo);
if (0xFFFFFFFF == fileAttr)
@@ -353,11 +358,12 @@ bool DirAccessWindows::dir_exists(String p_dir) {
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
} else {
- DWORD fileAttr;
+ DWORD fileAttr;
fileAttr = GetFileAttributesExA(p_dir.ascii().get_data(), GetFileExInfoStandard, &fileInfo);
if (0xFFFFFFFF == fileAttr)
return false;
+
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
}