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 get_dir() behavior on Windows #763

Closed
wants to merge 3 commits into from

Conversation

kadykov
Copy link
Contributor

@kadykov kadykov commented Sep 6, 2023

This PR fixes get_dir() behavior on the Windows platform.

It is supposed to replace #743, and should be compatible with #761.

Function get_dir() is rewritten according to the tests in test_local.test_get_dir(), but the expected behavior is quite weird.
It looks like the real problem is somewhere else, but we are trying to patch it here.

# leave the path without '/' in the end
return f"{protocol}://{dirname}"
# get absolute path, convert to posix and add '/' in the end
return f"{os.path.abspath(dirname).replace(os.sep, r'/')}/"
Copy link
Member

Choose a reason for hiding this comment

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

Will this not produce the OS-dependent version of the path?
I wonder whether fsspec.core.url_to_fs might be a more appropriate function for this job.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be quite challenging due to its strange behavior.
I have prepared another solution #768

@kadykov kadykov mentioned this pull request Sep 11, 2023
@kadykov kadykov closed this Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants