Fix trap extension for source files without extensions

We were writing files with names like `Gemfile..trap.gz`. Now fixed to
`Gemfile.trap.gz`.
This commit is contained in:
Nick Rolfe
2021-09-20 12:11:00 +01:00
parent 4bfbf62e13
commit 0936c4cd7b

View File

@@ -40,8 +40,8 @@ impl TrapCompression {
fn extension(&self) -> &str {
match self {
TrapCompression::None => ".trap",
TrapCompression::Gzip => ".trap.gz",
TrapCompression::None => "trap",
TrapCompression::Gzip => "trap.gz",
}
}
}
@@ -269,6 +269,7 @@ fn path_for(dir: &Path, path: &Path, ext: &str) -> PathBuf {
}
if let Some(x) = result.extension() {
let mut new_ext = x.to_os_string();
new_ext.push(".");
new_ext.push(ext);
result.set_extension(new_ext);
} else {