-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
refactor: use Path/PathBuf in deno dir #2559
refactor: use Path/PathBuf in deno dir #2559
Conversation
This reverts commit 2efca8f.
@ry PTAL if this direction is satisfactory. Handling of paths was replaced with use of |
CC @kitsonk |
@@ -27,6 +27,18 @@ use std::str; | |||
use url; | |||
use url::Url; | |||
|
|||
fn normalize_path(path: &Path) -> PathBuf { |
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.
Does this even make sense in when using Path
and PathBuf
instead of String
?
I think you should try removing this function entirely.
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 it does... PTAL at this comment.
I tried removing this method, but that caused Windows build to start failing.
I'd prefer to normalize all paths to use forwards slashes everywhere in our codebase, just to simplify manipulating for us, std::fs
methods are able to use forward slashes appropriately on Windows.
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use tempfile::TempDir; | ||
|
||
fn normalize_to_str(path: &Path) -> String { | ||
normalize_path(path).to_str().unwrap().to_string() | ||
} |
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.
Try removing this... does it still work?
@bartlomieju Please merge with master |
@ry merged |
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.
LGTM
This is preliminary work towards #2057
Refactoring
//cli/deno_dir.rs
to use more concrete types, because there is a hell lot of&str
arguments