mirror of https://github.com/rwf2/Rocket.git
changed Windows transform code to an statement
This commit is contained in:
parent
840da927d1
commit
7d35841502
|
@ -191,13 +191,12 @@ fn split_path(path: &Path) -> (PathBuf, String, Option<String>) {
|
||||||
let rel_path = path.strip_prefix(&*TEMPLATE_DIR).unwrap().to_path_buf();
|
let rel_path = path.strip_prefix(&*TEMPLATE_DIR).unwrap().to_path_buf();
|
||||||
let path_no_ext = remove_extension(&rel_path);
|
let path_no_ext = remove_extension(&rel_path);
|
||||||
let data_type = path_no_ext.extension();
|
let data_type = path_no_ext.extension();
|
||||||
let name = remove_extension(&path_no_ext).to_string_lossy().into_owned();
|
let mut name = remove_extension(&path_no_ext).to_string_lossy().into_owned();
|
||||||
|
|
||||||
// Ensure template name consistency on Windows systems
|
// Ensure template name consistency on Windows systems
|
||||||
let name = match cfg!(windows) {
|
if cfg!(windows) {
|
||||||
true => name.replace("\\", "/"),
|
name = name.replace("\\", "/");
|
||||||
false => name,
|
}
|
||||||
};
|
|
||||||
|
|
||||||
(rel_path, name, data_type.map(|d| d.to_string_lossy().into_owned()))
|
(rel_path, name, data_type.map(|d| d.to_string_lossy().into_owned()))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue