You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-30 18:30:54 +00:00
[Unix] Remove leading .. from absolute paths and apply simplify_path to Unix current directory path.
This commit is contained in:
@@ -4189,6 +4189,9 @@ String String::simplify_path() const {
|
||||
}
|
||||
}
|
||||
Vector<String> dirs = s.split("/", false);
|
||||
bool absolute_path = is_absolute_path();
|
||||
|
||||
absolute_path = absolute_path && !begins_with("res://"); // FIXME: Some code (GLTF importer) rely on accessing files up from `res://`, this probably should be disabled in the future.
|
||||
|
||||
for (int i = 0; i < dirs.size(); i++) {
|
||||
String d = dirs[i];
|
||||
@@ -4200,6 +4203,9 @@ String String::simplify_path() const {
|
||||
dirs.remove_at(i);
|
||||
dirs.remove_at(i - 1);
|
||||
i -= 2;
|
||||
} else if (absolute_path && i == 0) {
|
||||
dirs.remove_at(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user