changed Windows transform code to an statement

This commit is contained in:
Marcus Ball 2016-12-28 23:38:31 -05:00
parent 840da927d1
commit 7d35841502
1 changed files with 4 additions and 5 deletions

View File

@ -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()))
} }