aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index f4a7aa7..e2dacb7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,7 @@ use std::{
};
use clap::Parser;
-use color_eyre::eyre::{bail, Context, Result};
+use color_eyre::eyre::{bail, eyre, Context, Result};
use indicatif::{MultiProgress, ProgressBar, ProgressDrawTarget, ProgressStyle};
use is_terminal::IsTerminal;
use rayon::ThreadPoolBuilder;
@@ -14,6 +14,8 @@ mod gpx;
mod layer;
mod renderer;
+use gpx::Compression;
+
#[derive(Parser, Debug, Clone)]
#[command(author, version, about)]
struct Args {
@@ -70,7 +72,9 @@ fn main() -> Result<()> {
let mut tracks = Vec::new();
for file in &args.files {
- let data = gpx::extract_from_file(file, gpx::Compression::None).unwrap();
+ let compression = Compression::suggest_from_path(file)
+ .ok_or_else(|| eyre!("Could not determine format for {file:?}"))?;
+ let data = gpx::extract_from_file(file, compression)?;
tracks.push(data);
bar.inc(1);
}