Skip to content

Commit 5e42029

Browse files
rootroot
authored andcommitted
fixup! sim-ln/refactor: move parsing into its own module
1 parent f5baa32 commit 5e42029

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
@@ -301,17 +301,19 @@ async fn validate_activities(
301301
Ok(validated_activities)
302302
}
303303

304-
pub async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
305-
let sim_path = if sim_file.is_relative() {
306-
data_dir.join(sim_file)
307-
} else {
308-
sim_file
309-
};
310-
311-
if sim_path.exists() {
312-
Ok(sim_path)
304+
async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
305+
if sim_file.exists() {
306+
Ok(sim_file)
307+
} else if sim_file.is_relative() {
308+
let sim_path = data_dir.join(sim_file);
309+
if sim_path.exists() {
310+
Ok(sim_path)
311+
} else {
312+
log::info!("Simulation file '{}' does not exist.", sim_path.display());
313+
select_sim_file(data_dir).await
314+
}
313315
} else {
314-
log::info!("Simulation file '{}' does not exist.", sim_path.display());
316+
log::info!("Simulation file '{}' does not exist.", sim_file.display());
315317
select_sim_file(data_dir).await
316318
}
317319
}

0 commit comments

Comments
 (0)