-
Notifications
You must be signed in to change notification settings - Fork 24
refactor!: use same paths representation for unix/windows #390
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
base: main
Are you sure you want to change the base?
Conversation
dbc9dab
to
32ae757
Compare
a9d526f
to
af6ae1c
Compare
6731779
to
626d588
Compare
I manually rebased to newest main. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only 2/42 files in but have a question
}; | ||
let node = Node::new_node(&p, NodeType::Dir, meta); | ||
return Some(TreeType::NewTree((self.path.clone(), node, p))); | ||
if let Some(p) = missing_dirs.components().next() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the for loop
?
Both typed_path::UnixPathBuf::components
and std::path::PathBuf::components
seem "normalize" the same way their output (methods have identical documentation) which makes me wonder why it's ok to remove the loop.
PS: after seeing the now deleted comp_to_osstr
, I am starting to think, that the typed_path::UnixPathBuf::components
output might be "much" simpler than std..
, is it related to that?
#[case(r#"d:\"#, "/d")] | ||
#[case(r#"a\b\"#, "a/b")] | ||
#[case(r#"a\b\c"#, "a/b/c")] | ||
fn test_windows_path_to_unix_path(#[case] windows_path: &str, #[case] unix_path: &str) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe more testing could be good for these methods, for instance: are conversion methods reversible? foo == windows_to_unix(unix_to_windows(foo))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you thing about renaming this file, could be something like path_util
.
I propose that because there are only path related utils methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, all these conversions could be error prone. I don't feel confident in my review for this part.
waiting for BurntSushi/ripgrep@79f5a5a to be released in |
Use typed_path to use a common unix path representation on both windows/unix. This will increase windows compatibility and makes testing easier.
PR in rustic to integrate this change: rustic-rs/rustic#1466