Skip to content

Commit e95925a

Browse files
committed
Fix bug in input sequence handling
1 parent 0bb935e commit e95925a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ The following changes are present in the `main` branch of the repository and are
44

55
- No major changes since last release
66

7+
## Version 0.9.1
8+
9+
- CLI: Fix bug where no input sequence files were found if the sequence pattern path did not contain any "parent" path (e.g. `file_{}.vtk` instead of `./file_{}.vtk`)
10+
711
## Version 0.9.0
812

913
- Upgrade to Rust edition 2021

splashsurf/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "splashsurf"
3-
version = "0.9.0"
3+
version = "0.9.1"
44
authors = ["Fabian Löschner <[email protected]>"]
55
license = "MIT"
66
description = "Command-line tool for surface reconstruction of SPH particle data"

splashsurf/src/reconstruction.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ mod arguments {
464464
let input_file = &self.input_file;
465465
let output_file = &self.output_file;
466466

467-
let input_dir = input_file.parent().unwrap();
468-
let output_dir = output_file.parent().unwrap();
467+
let input_dir = input_file.parent().expect("expected an input path ending in a filename");
468+
let output_dir = output_file.parent().expect("expected an output path ending in a filename");
469469

470470
let input_pattern = input_file.file_name().unwrap().to_string_lossy();
471471
let output_pattern = output_file.file_name().unwrap().to_string_lossy();
@@ -478,9 +478,12 @@ mod arguments {
478478
format!(r"{}(\d+){}", escape(input_prefix), escape(input_suffix));
479479
let input_re = Regex::new(&input_re_str).expect("expected a valid regex");
480480

481+
let input_root = if input_dir == Path::new("") { Path::new(".") } else { input_dir };
482+
info!("Looking for input sequence files in root \"{}\"", input_root.display());
483+
481484
let mut paths = Vec::new();
482485

483-
for entry in WalkDir::new(input_dir)
486+
for entry in WalkDir::new(input_root)
484487
.max_depth(1)
485488
.contents_first(true)
486489
.sort_by_file_name()

0 commit comments

Comments
 (0)