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

Use std::path::absolute #333

Closed
wants to merge 2 commits into from
Closed

Use std::path::absolute #333

wants to merge 2 commits into from

Conversation

gustavo-shigueo
Copy link
Collaborator

Goal

Replace our hand implemented absolute path generator with the one provided by the Rust std lib
Closes #332

Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

@gustavo-shigueo
Copy link
Collaborator Author

gustavo-shigueo commented Jun 21, 2024

It appears that the std::path::absolute function only removes .. components from paths on windows

/// The path is resolved using [POSIX semantics][posix-semantics] except that
/// it stops short of resolving symlinks. This means it will keep ..
/// components and trailing slashes.

@NyxCode
Copy link
Collaborator

NyxCode commented Jun 21, 2024

Ah, that sucks. I vaguely recall that there also was some reason we couldn't use std::fs::canonicalize, so idk. - maybe we should just keep it as-is? 😅

@gustavo-shigueo
Copy link
Collaborator Author

std::fs::canonicalize requires the path to already exist, so it can't be used to create files or directories

@gustavo-shigueo gustavo-shigueo deleted the std_path_absolute branch June 26, 2024 18:11
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.

Use std::path::absolute
2 participants