From 664c461d284978cb48b0c94a744f0b4bbacad61c Mon Sep 17 00:00:00 2001 From: keptsecret Date: Sat, 5 Mar 2022 21:48:41 -0500 Subject: fixed unable to change directory in user access mode --- core/io/dir_access.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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; -- cgit v1.2.3