summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkeptsecret <sorchon@gmail.com>2022-03-05 21:48:41 -0500
committerkeptsecret <sorchon@gmail.com>2022-03-09 19:33:56 -0500
commit664c461d284978cb48b0c94a744f0b4bbacad61c (patch)
tree46ba8a4f9006610251f52b2d8e2b30977c93bed3
parentc9d052330291b726660f3ac397ec82dbcf638bf0 (diff)
fixed unable to change directory in user access mode
-rw-r--r--core/io/dir_access.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/io/dir_access.cpp b/core/io/dir_access.cpp
index 86d8dea3d9..0e5ed8c29f 100644
--- a/core/io/dir_access.cpp
+++ b/core/io/dir_access.cpp
@@ -250,6 +250,14 @@ DirAccess *DirAccess::create(AccessType p_access) {
DirAccess *da = create_func[p_access] ? create_func[p_access]() : nullptr;
if (da) {
da->_access_type = p_access;
+
+ // for ACCESS_RESOURCES and ACCESS_FILESYSTEM, current_dir already defaults to where game was started
+ // in case current directory is force changed elsewhere for ACCESS_RESOURCES
+ if (p_access == ACCESS_RESOURCES) {
+ da->change_dir("res://");
+ } else if (p_access == ACCESS_USERDATA) {
+ da->change_dir("user://");
+ }
}
return da;