Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirAccessPack: Fix file_exists and dir_exists in exported projects #98483

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Oct 24, 2024

Fixes #87552

The fix_path() calls were added in #31440 as a hotfix for a similar problem.

At that time, dir_exists() simply checks if the given path is a key of the subdirs map of the current directory. That's why dir_exists() did not work for absolute paths and using fix_path() to strip res:// prefix solved the problem.

In 4.0, #40748 improved the DirAccessPack API with a better way to find subdirectories: _find_dir(). This method supports both relative and absolute paths. But since fix_path() is still called for the incoming parameters, absolute paths always become relative paths, so it might be checking the wrong directory depending on the current directory of DirAccess.

@timothyqiu timothyqiu added this to the 4.4 milestone Oct 24, 2024
@timothyqiu timothyqiu requested a review from a team as a code owner October 24, 2024 06:49
@akien-mga akien-mga requested a review from bruvzg November 12, 2024 15:22
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Was not able to fully test it, currently loading exported projects seems to be broken (at least in ec6a1c0), something wrong with scene remaps (will check it tomorrow).

@Repiteo Repiteo merged commit 80e73b0 into godotengine:master Nov 18, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 18, 2024

Thanks!

@timothyqiu timothyqiu deleted the pack-dir-exists branch November 18, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DirAccess instance methods file_exists and dir_exists do not find files/dirs in exported projects
3 participants