1
0
mirror of https://github.com/sharkdp/bat synced 2026-07-24 17:13:19 +00:00

Small refactoring, handle invalid UTF-8 filenames

This commit is contained in:
sharkdp
2020-04-21 08:19:24 +02:00
committed by David Peter
parent 83d408bab3
commit 34619a2e89
5 changed files with 47 additions and 25 deletions
+4 -3
View File
@@ -264,9 +264,10 @@ impl App {
if input.to_str().unwrap() == "-" {
file_input.push(InputFile::StdIn(name));
} else {
let ofile = name.map_or(OrdinaryFile::from_path(input), |n| {
OrdinaryFile::from_path_with_name(input, n)
});
let mut ofile = OrdinaryFile::from_path(input);
if let Some(path) = name {
ofile.set_provided_path(path);
}
file_input.push(InputFile::Ordinary(ofile))
}
}