From 53b6369a1b0efffe1512f466fa8e4f2cd4ad92b0 Mon Sep 17 00:00:00 2001 From: Jacquin Antoine Date: Thu, 14 May 2026 21:17:03 +0200 Subject: [PATCH] Fix --file argument to accept full filenames with extensions Previously --file LHD_FXX_...copc.laz would fail because it appended extensions. Now tries exact filename match first, then falls back to adding extensions. Co-Authored-By: Claude Opus 4.6 --- lidar_pipeline/cli.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lidar_pipeline/cli.py b/lidar_pipeline/cli.py index 29bfa7f..6141de0 100644 --- a/lidar_pipeline/cli.py +++ b/lidar_pipeline/cli.py @@ -216,10 +216,16 @@ Exemples: # Also supports bare name without .copc (e.g. LHD_FXX_1000_6882_PTS_LAMB93_IGN69) selected_files = [] for pattern in args.file: - matches = (list(input_dir.glob(f"{pattern}.laz")) - + list(input_dir.glob(f"{pattern}.las")) - + list(input_dir.glob(f"{pattern}.copc.laz")) - + list(input_dir.glob(f"{pattern}.copc.las"))) + # Try exact filename first (e.g. LHD_FXX_...copc.laz) + exact_match = input_dir / pattern + if exact_match.exists() and exact_match.is_file(): + matches = [exact_match] + else: + # Try with added extensions (e.g. pattern=LHD_FXX_...IGN69) + matches = (list(input_dir.glob(f"{pattern}.laz")) + + list(input_dir.glob(f"{pattern}.las")) + + list(input_dir.glob(f"{pattern}.copc.laz")) + + list(input_dir.glob(f"{pattern}.copc.las"))) # Remove duplicates matches = list(dict.fromkeys(matches)) if not matches: