mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-06 12:58:45 +08:00
Create file now support default output filename with no extension
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -1494,10 +1494,14 @@ pub fn create_file(
|
||||
Some(output) => output.to_string(),
|
||||
None => {
|
||||
let mut pb = std::path::PathBuf::from(input);
|
||||
let ext = builder.extensions().first().unwrap_or(&"unk");
|
||||
let ext = builder.extensions().first().unwrap_or(&"");
|
||||
pb.set_extension(ext);
|
||||
if pb.to_string_lossy() == input {
|
||||
pb.set_extension(format!("{}.{}", ext, ext));
|
||||
if ext.is_empty() {
|
||||
pb.set_extension("unk");
|
||||
} else {
|
||||
pb.set_extension(format!("{}.{}", ext, ext));
|
||||
}
|
||||
}
|
||||
pb.to_string_lossy().into_owned()
|
||||
}
|
||||
@@ -1517,10 +1521,14 @@ pub fn create_file(
|
||||
Some(output) => output.to_string(),
|
||||
None => {
|
||||
let mut pb = std::path::PathBuf::from(input);
|
||||
let ext = builder.extensions().first().unwrap_or(&"unk");
|
||||
let ext = builder.extensions().first().unwrap_or(&"");
|
||||
pb.set_extension(ext);
|
||||
if pb.to_string_lossy() == input {
|
||||
pb.set_extension(format!("{}.{}", ext, ext));
|
||||
if ext.is_empty() {
|
||||
pb.set_extension("unk");
|
||||
} else {
|
||||
pb.set_extension(format!("{}.{}", ext, ext));
|
||||
}
|
||||
}
|
||||
pb.to_string_lossy().into_owned()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user