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 <noreply@anthropic.com>
This commit is contained in:
Jacquin Antoine
2026-05-14 21:17:03 +02:00
parent 34b79ac2c2
commit 53b6369a1b

View File

@ -216,10 +216,16 @@ Exemples:
# Also supports bare name without .copc (e.g. LHD_FXX_1000_6882_PTS_LAMB93_IGN69) # Also supports bare name without .copc (e.g. LHD_FXX_1000_6882_PTS_LAMB93_IGN69)
selected_files = [] selected_files = []
for pattern in args.file: for pattern in args.file:
matches = (list(input_dir.glob(f"{pattern}.laz")) # Try exact filename first (e.g. LHD_FXX_...copc.laz)
+ list(input_dir.glob(f"{pattern}.las")) exact_match = input_dir / pattern
+ list(input_dir.glob(f"{pattern}.copc.laz")) if exact_match.exists() and exact_match.is_file():
+ list(input_dir.glob(f"{pattern}.copc.las"))) 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 # Remove duplicates
matches = list(dict.fromkeys(matches)) matches = list(dict.fromkeys(matches))
if not matches: if not matches: