You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Added missing path verification on Unix, closes #20762
This commit is contained in:
@@ -328,6 +328,17 @@ Error DirAccessUnix::change_dir(String p_dir) {
|
|||||||
return ERR_INVALID_PARAMETER;
|
return ERR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String base = _get_root_path();
|
||||||
|
if (base != String()) {
|
||||||
|
ERR_FAIL_COND_V(getcwd(real_current_dir_name, 2048) == NULL, ERR_BUG);
|
||||||
|
String new_dir;
|
||||||
|
new_dir.parse_utf8(real_current_dir_name);
|
||||||
|
|
||||||
|
if (!new_dir.begins_with(base)) {
|
||||||
|
try_dir = current_dir; //revert
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// the directory exists, so set current_dir to try_dir
|
// the directory exists, so set current_dir to try_dir
|
||||||
current_dir = try_dir;
|
current_dir = try_dir;
|
||||||
ERR_FAIL_COND_V(chdir(prev_dir.utf8().get_data()) != 0, ERR_BUG);
|
ERR_FAIL_COND_V(chdir(prev_dir.utf8().get_data()) != 0, ERR_BUG);
|
||||||
|
|||||||
Reference in New Issue
Block a user