diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-18 09:23:44 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-18 09:23:44 -0600 |
commit | 0dda6a974c0b782216b3bf8a2a27fdbc5b0a6cd9 (patch) | |
tree | 459bd053a953a12a425c8cb467bd1389e5811b74 /core/io/file_access.cpp | |
parent | 1dcb6863254f41a606b0d878b8cd2eeafe060e73 (diff) | |
parent | 3b6705a641d9dfd2fcee24cbbdfa88efca79a840 (diff) | |
download | redot-engine-0dda6a974c0b782216b3bf8a2a27fdbc5b0a6cd9.tar.gz |
Merge pull request #99286 from KoBeWi/uid_in_a_path_factory
Support uid:// in more places
Diffstat (limited to 'core/io/file_access.cpp')
-rw-r--r-- | core/io/file_access.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/io/file_access.cpp b/core/io/file_access.cpp index dd826e626b..ef5ca502d4 100644 --- a/core/io/file_access.cpp +++ b/core/io/file_access.cpp @@ -71,7 +71,7 @@ void FileAccess::_set_access_type(AccessType p_access) { Ref<FileAccess> FileAccess::create_for_path(const String &p_path) { Ref<FileAccess> ret; - if (p_path.begins_with("res://")) { + if (p_path.begins_with("res://") || p_path.begins_with("uid://")) { ret = create(ACCESS_RESOURCES); } else if (p_path.begins_with("user://")) { ret = create(ACCESS_USERDATA); @@ -183,13 +183,17 @@ FileAccess::AccessType FileAccess::get_access_type() const { } String FileAccess::fix_path(const String &p_path) const { - //helper used by file accesses that use a single filesystem + // Helper used by file accesses that use a single filesystem. String r_path = p_path.replace("\\", "/"); switch (_access_type) { case ACCESS_RESOURCES: { if (ProjectSettings::get_singleton()) { + if (r_path.begins_with("uid://")) { + r_path = ResourceUID::uid_to_path(r_path); + } + if (r_path.begins_with("res://")) { String resource_path = ProjectSettings::get_singleton()->get_resource_path(); if (!resource_path.is_empty()) { |