diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-08-23 03:58:59 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-08-23 09:41:08 -0400 |
commit | ecb955929fd528f19c5fab9e4e904b621d8cf94d (patch) | |
tree | adbbce9bc26a3189cdb5b67ae8aa3d15299ad704 /src/fs.rs | |
parent | e2f9b0e6fd01c4ad8d7fc966a531e48e5aaa334f (diff) |
Normalize windows paths.
Add resolve_module test
Diffstat (limited to 'src/fs.rs')
-rw-r--r-- | src/fs.rs | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -34,3 +34,13 @@ pub fn mkdir(path: &Path) -> std::io::Result<()> { } }) } + +pub fn normalize_path(path: &Path) -> String { + let s = String::from(path.to_str().unwrap()); + if cfg!(windows) { + // TODO This isn't correct. Probbly should iterate over components. + s.replace("\\", "/") + } else { + s + } +} |