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

Fix ProjectSettings::localize_path for Windows paths #79342

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

RedworkDE
Copy link
Member

If a path with \ was passed in it would never be recognized as being in the resource path and never become a local path. Thus move the simplify_path earlier to fix that. (The replace call is unnecessary because simplify_path already does that)

(Tbh there are probably still edge cases where something like this can happen esp when involving symlinks or such)

@RedworkDE RedworkDE added this to the 4.2 milestone Jul 11, 2023
@RedworkDE RedworkDE requested a review from a team as a code owner July 11, 2023 14:28
@raulsntos
Copy link
Member

It seems like we have tests for ProjectSettings (https://github.com/godotengine/godot/blob/23318e877890029f35856036b9c4e0bfa09cacc6/tests/core/config/test_project_settings.h) but it doesn't contain a test for the localize_path method. Could you add one?

CHECK_EQ(ProjectSettings::get_singleton()->localize_path("path/./filename"), "res://path/filename");
CHECK_EQ(ProjectSettings::get_singleton()->localize_path("path\\.\\filename"), "res://path/filename");

// FIXME?: These checks pass, but that doesn't seems correct
Copy link
Member Author

Choose a reason for hiding this comment

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

These have passed before as well, this behavior isn't new. Only the last 4 checks are actually affected by this PR.

@akien-mga akien-mga merged commit 432405a into godotengine:master Aug 7, 2023
@akien-mga
Copy link
Member

Thanks!

@RedworkDE RedworkDE deleted the localize-win-path branch August 7, 2023 16:02
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.

5 participants