Skip to content

Commit 8af12a1

Browse files
authored
Merge pull request #298 from github/trap_extension
Fix trap extension for source files without extensions
2 parents 4bfbf62 + c30c7b3 commit 8af12a1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

extractor/src/main.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ impl TrapCompression {
4040

4141
fn extension(&self) -> &str {
4242
match self {
43-
TrapCompression::None => ".trap",
44-
TrapCompression::Gzip => ".trap.gz",
43+
TrapCompression::None => "trap",
44+
TrapCompression::Gzip => "trap.gz",
4545
}
4646
}
4747
}
@@ -267,12 +267,16 @@ fn path_for(dir: &Path, path: &Path, ext: &str) -> PathBuf {
267267
}
268268
}
269269
}
270-
if let Some(x) = result.extension() {
271-
let mut new_ext = x.to_os_string();
272-
new_ext.push(ext);
273-
result.set_extension(new_ext);
274-
} else {
275-
result.set_extension(ext);
270+
match result.extension() {
271+
Some(x) => {
272+
let mut new_ext = x.to_os_string();
273+
new_ext.push(".");
274+
new_ext.push(ext);
275+
result.set_extension(new_ext);
276+
}
277+
None => {
278+
result.set_extension(ext);
279+
}
276280
}
277281
result
278282
}

0 commit comments

Comments
 (0)