mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 10:54:38 +00:00
Avoid Path::with_extension because it can replace extension
This commit is contained in:
parent
a8c086d2c9
commit
36628900e5
1 changed files with 8 additions and 4 deletions
|
@ -290,10 +290,14 @@ fn unpack(aes_key: Option<aes::Aes256>, action: ActionUnpack) -> Result<(), repa
|
|||
}
|
||||
|
||||
fn pack(args: ActionPack) -> Result<(), repak::Error> {
|
||||
let output = args
|
||||
.output
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| Path::new(&args.input).with_extension("pak"));
|
||||
let output = args.output.map(PathBuf::from).unwrap_or_else(|| {
|
||||
let mut output = PathBuf::new();
|
||||
output.push(&args.input);
|
||||
// NOTE: don't use `with_extension` here because it will replace e.g. the `.1` in
|
||||
// `test_v1.1`.
|
||||
output.push(".pak");
|
||||
output
|
||||
});
|
||||
|
||||
fn collect_files(paths: &mut Vec<PathBuf>, dir: &Path) -> io::Result<()> {
|
||||
for entry in fs::read_dir(dir)? {
|
||||
|
|
Loading…
Reference in a new issue