Skip to content

Commit fa1934e

Browse files
rootroot
authored andcommitted
Apply fix from PR #228 to parsing module
1 parent 89b9d04 commit fa1934e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

sim-cli/src/parsing.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,19 @@ async fn validate_activities(
331331
Ok(validated_activities)
332332
}
333333

334-
pub async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
335-
let sim_path = if sim_file.is_relative() {
336-
data_dir.join(sim_file)
337-
} else {
338-
sim_file
339-
};
340-
341-
if sim_path.exists() {
342-
Ok(sim_path)
334+
async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
335+
if sim_file.exists() {
336+
Ok(sim_file)
337+
} else if sim_file.is_relative() {
338+
let sim_path = data_dir.join(sim_file);
339+
if sim_path.exists() {
340+
Ok(sim_path)
341+
} else {
342+
log::info!("Simulation file '{}' does not exist.", sim_path.display());
343+
select_sim_file(data_dir).await
344+
}
343345
} else {
344-
log::info!("Simulation file '{}' does not exist.", sim_path.display());
346+
log::info!("Simulation file '{}' does not exist.", sim_file.display());
345347
select_sim_file(data_dir).await
346348
}
347349
}

0 commit comments

Comments
 (0)