summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2024-10-03 17:14:44 +0300
committerDanil Alexeev <danil@alexeev.xyz>2024-10-03 17:14:44 +0300
commit6286f9d21d4c7604ae0fd91e49896da79f0b78f7 (patch)
treee09c54c883e9ce61a4364f5cfb61de8ebfb3e7d6
parent2e144928793f17ebd70e1475bb7a7f4fd1095484 (diff)
downloadredot-engine-6286f9d21d4c7604ae0fd91e49896da79f0b78f7.tar.gz
GDScript: Fix `GDScriptCache::get_full_script()` uses non-remapped path
-rw-r--r--modules/gdscript/gdscript_cache.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp
index b3c0744bdf..3c022412bd 100644
--- a/modules/gdscript/gdscript_cache.cpp
+++ b/modules/gdscript/gdscript_cache.cpp
@@ -297,6 +297,7 @@ Vector<uint8_t> GDScriptCache::get_binary_tokens(const String &p_path) {
Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, Error &r_error, const String &p_owner) {
MutexLock lock(singleton->mutex);
+
if (!p_owner.is_empty()) {
singleton->dependencies[p_owner].insert(p_path);
}
@@ -307,7 +308,7 @@ Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, Error &r_e
return singleton->shallow_gdscript_cache[p_path];
}
- String remapped_path = ResourceLoader::path_remap(p_path);
+ const String remapped_path = ResourceLoader::path_remap(p_path);
Ref<GDScript> script;
script.instantiate();
@@ -332,6 +333,7 @@ Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, Error &r_e
}
singleton->shallow_gdscript_cache[p_path] = script;
+
return script;
}
@@ -359,16 +361,18 @@ Ref<GDScript> GDScriptCache::get_full_script(const String &p_path, Error &r_erro
}
}
+ const String remapped_path = ResourceLoader::path_remap(p_path);
+
if (p_update_from_disk) {
- if (p_path.get_extension().to_lower() == "gdc") {
- Vector<uint8_t> buffer = get_binary_tokens(p_path);
+ if (remapped_path.get_extension().to_lower() == "gdc") {
+ Vector<uint8_t> buffer = get_binary_tokens(remapped_path);
if (buffer.is_empty()) {
r_error = ERR_FILE_CANT_READ;
return script;
}
script->set_binary_tokens_source(buffer);
} else {
- r_error = script->load_source_code(p_path);
+ r_error = script->load_source_code(remapped_path);
if (r_error) {
return script;
}