Skip to content

Commit 30f542b

Browse files
rootroot
root
authored and
root
committed
sim-ln/refactor: Apply fix from PR #228 to parsing module
1 parent 329904f commit 30f542b

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
@@ -311,17 +311,19 @@ async fn validate_activities(
311311
Ok(validated_activities)
312312
}
313313

314-
pub async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
315-
let sim_path = if sim_file.is_relative() {
316-
data_dir.join(sim_file)
317-
} else {
318-
sim_file
319-
};
320-
321-
if sim_path.exists() {
322-
Ok(sim_path)
314+
async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
315+
if sim_file.exists() {
316+
Ok(sim_file)
317+
} else if sim_file.is_relative() {
318+
let sim_path = data_dir.join(sim_file);
319+
if sim_path.exists() {
320+
Ok(sim_path)
321+
} else {
322+
log::info!("Simulation file '{}' does not exist.", sim_path.display());
323+
select_sim_file(data_dir).await
324+
}
323325
} else {
324-
log::info!("Simulation file '{}' does not exist.", sim_path.display());
326+
log::info!("Simulation file '{}' does not exist.", sim_file.display());
325327
select_sim_file(data_dir).await
326328
}
327329
}

0 commit comments

Comments
 (0)