summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-07-03 09:53:52 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-07-05 09:38:28 +0200
commit0639946c72ba6632bc3b0953d64f644af328e5e6 (patch)
tree8fc1624cf662f7d7eba1de9eabd595f4edcd38f8 /core
parentaa9908e4f601e368517c6f23406e8c15e3f197a3 (diff)
Fix localize_path not always working
We make sure the resource dir path ends with a trailing '/' for safety reasons, so we must make sure the path we compare it to does so as well.
Diffstat (limited to 'core')
-rw-r--r--core/project_settings.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index fc1a74801d..a9cc529cdc 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -83,6 +83,10 @@ String ProjectSettings::localize_path(const String &p_path) const {
// `plus_file("")` is an easy way to ensure we have a trailing '/'.
const String res_path = resource_path.plus_file("");
+ // DirAccess::get_current_dir() is not guaranteed to return a path that with a trailing '/',
+ // so we must make sure we have it as well in order to compare with 'res_path'.
+ cwd = cwd.plus_file("");
+
if (!cwd.begins_with(res_path)) {
return p_path;
};