mirror of
https://codeberg.org/icewind/tf-log-parser.git
synced 2026-06-03 18:24:09 +02:00
lossy utf8
This commit is contained in:
parent
c73828a2db
commit
b95c58a257
2 changed files with 4 additions and 2 deletions
|
|
@ -57,13 +57,14 @@ fn main() -> Result<(), MainError> {
|
||||||
if path.extension() == Some(OsStr::new("log")) {
|
if path.extension() == Some(OsStr::new("log")) {
|
||||||
// let _ = print!("{} - ", path.display());
|
// let _ = print!("{} - ", path.display());
|
||||||
let read_start = Instant::now();
|
let read_start = Instant::now();
|
||||||
let input = match fs::read_to_string(path) {
|
let input = match fs::read(path) {
|
||||||
Ok(input) => input,
|
Ok(input) => input,
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
// println!("failed to read file: {}", e);
|
// println!("failed to read file: {}", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let input = String::from_utf8_lossy(&input);
|
||||||
|
|
||||||
read_time.fetch_add(read_start.elapsed().as_micros() as usize, Ordering::Relaxed);
|
read_time.fetch_add(read_start.elapsed().as_micros() as usize, Ordering::Relaxed);
|
||||||
let parse_start = Instant::now();
|
let parse_start = Instant::now();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ use tf_log_parser::parse;
|
||||||
|
|
||||||
fn main() -> Result<(), MainError> {
|
fn main() -> Result<(), MainError> {
|
||||||
let path = args().nth(1).expect("No path provided");
|
let path = args().nth(1).expect("No path provided");
|
||||||
let content = fs::read_to_string(path)?;
|
let content = fs::read(path)?;
|
||||||
|
let content = String::from_utf8_lossy(&content);
|
||||||
|
|
||||||
let log = parse(&content)?;
|
let log = parse(&content)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue