summaryrefslogtreecommitdiffstats
path: root/core/io/file_access_pack.h
diff options
context:
space:
mode:
authorjpcerrone <jpcerronex@gmail.com>2023-05-22 15:03:05 -0300
committerjpcerrone <jpcerronex@gmail.com>2023-05-22 15:03:05 -0300
commit0fb307720c0bf70466935334facbe109a5a4d20a (patch)
treebb82eaf3c08df7ad01dc0bd7d38f78bb7da10900 /core/io/file_access_pack.h
parent5dc093b19a26b5055ceecaf1e1076bb5b4529a5a (diff)
downloadredot-engine-0fb307720c0bf70466935334facbe109a5a4d20a.tar.gz
PCK file path improvements
Fixes godotengine#77317 (Inconsistent PCK file path behaviour). Simplifies all PCK file paths so that paths with extra '/' symbols in them still match to the same path. Fixes various FileAccess methods that didn't work when using PCK paths that contain extra '/' symbols.
Diffstat (limited to 'core/io/file_access_pack.h')
-rw-r--r--core/io/file_access_pack.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h
index 8bfabc9529..1538b302c2 100644
--- a/core/io/file_access_pack.h
+++ b/core/io/file_access_pack.h
@@ -184,7 +184,8 @@ public:
};
Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
- PathMD5 pmd5(p_path.md5_buffer());
+ String simplified_path = p_path.simplify_path();
+ PathMD5 pmd5(simplified_path.md5_buffer());
HashMap<PathMD5, PackedFile, PathMD5>::Iterator E = files.find(pmd5);
if (!E) {
return nullptr; //not found
@@ -197,7 +198,7 @@ Ref<FileAccess> PackedData::try_open_path(const String &p_path) {
}
bool PackedData::has_path(const String &p_path) {
- return files.has(PathMD5(p_path.md5_buffer()));
+ return files.has(PathMD5(p_path.simplify_path().md5_buffer()));
}
bool PackedData::has_directory(const String &p_path) {