Skip to content

Commit a1ca5ac

Browse files
authored
Merge pull request #228 from alexzaitsev/int-betw-sim-path-and-res-dir
sim-cli/bug: Interaction between simulation file path and results directory
2 parents 8366b49 + 94f56c6 commit a1ca5ac

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sim-cli/src/main.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,18 @@ async fn main() -> anyhow::Result<()> {
233233
}
234234

235235
async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
236-
let sim_path = if sim_file.is_relative() {
237-
data_dir.join(sim_file)
238-
} else {
239-
sim_file
240-
};
241-
242-
if sim_path.exists() {
243-
Ok(sim_path)
236+
if sim_file.exists() {
237+
Ok(sim_file)
238+
} else if sim_file.is_relative() {
239+
let sim_path = data_dir.join(sim_file);
240+
if sim_path.exists() {
241+
Ok(sim_path)
242+
} else {
243+
log::info!("Simulation file '{}' does not exist.", sim_path.display());
244+
select_sim_file(data_dir).await
245+
}
244246
} else {
245-
log::info!("Simulation file '{}' does not exist.", sim_path.display());
247+
log::info!("Simulation file '{}' does not exist.", sim_file.display());
246248
select_sim_file(data_dir).await
247249
}
248250
}

0 commit comments

Comments
 (0)