You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
Fixed DirAccessWindows::change_dir not working properly; Minor code formating clean up
This commit is contained in:
@@ -172,9 +172,10 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
|||||||
current_dir=real_current_dir_name; // TODO, utf8 parser
|
current_dir=real_current_dir_name; // TODO, utf8 parser
|
||||||
current_dir=current_dir.replace("\\","/");
|
current_dir=current_dir.replace("\\","/");
|
||||||
|
|
||||||
}
|
} else {
|
||||||
|
|
||||||
SetCurrentDirectoryW(prev_dir.c_str());
|
SetCurrentDirectoryW(prev_dir.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return worked?OK:ERR_INVALID_PARAMETER;
|
return worked?OK:ERR_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
@@ -192,9 +193,10 @@ Error DirAccessWindows::change_dir(String p_dir) {
|
|||||||
current_dir=real_current_dir_name; // TODO, utf8 parser
|
current_dir=real_current_dir_name; // TODO, utf8 parser
|
||||||
current_dir=current_dir.replace("\\","/");
|
current_dir=current_dir.replace("\\","/");
|
||||||
|
|
||||||
}
|
} else {
|
||||||
|
|
||||||
SetCurrentDirectoryA(prev_dir.ascii().get_data());
|
SetCurrentDirectoryA(prev_dir.ascii().get_data());
|
||||||
|
}
|
||||||
|
|
||||||
return worked?OK:ERR_INVALID_PARAMETER;
|
return worked?OK:ERR_INVALID_PARAMETER;
|
||||||
|
|
||||||
@@ -276,6 +278,7 @@ bool DirAccessWindows::file_exists(String p_file) {
|
|||||||
|
|
||||||
if (!p_file.is_abs_path())
|
if (!p_file.is_abs_path())
|
||||||
p_file=get_current_dir()+"/"+p_file;
|
p_file=get_current_dir()+"/"+p_file;
|
||||||
|
|
||||||
p_file=fix_path(p_file);
|
p_file=fix_path(p_file);
|
||||||
|
|
||||||
p_file.replace("/","\\");
|
p_file.replace("/","\\");
|
||||||
@@ -296,6 +299,7 @@ bool DirAccessWindows::file_exists(String p_file) {
|
|||||||
fileAttr = GetFileAttributesA(p_file.ascii().get_data());
|
fileAttr = GetFileAttributesA(p_file.ascii().get_data());
|
||||||
if (0xFFFFFFFF == fileAttr)
|
if (0xFFFFFFFF == fileAttr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
|
return !(fileAttr&FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -309,6 +313,7 @@ bool DirAccessWindows::dir_exists(String p_dir) {
|
|||||||
|
|
||||||
if (!p_dir.is_abs_path())
|
if (!p_dir.is_abs_path())
|
||||||
p_dir=get_current_dir()+"/"+p_dir;
|
p_dir=get_current_dir()+"/"+p_dir;
|
||||||
|
|
||||||
p_dir=fix_path(p_dir);
|
p_dir=fix_path(p_dir);
|
||||||
|
|
||||||
p_dir.replace("/","\\");
|
p_dir.replace("/","\\");
|
||||||
@@ -329,6 +334,7 @@ bool DirAccessWindows::dir_exists(String p_dir) {
|
|||||||
fileAttr = GetFileAttributesA(p_dir.ascii().get_data());
|
fileAttr = GetFileAttributesA(p_dir.ascii().get_data());
|
||||||
if (0xFFFFFFFF == fileAttr)
|
if (0xFFFFFFFF == fileAttr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
|
return (fileAttr&FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user