Skip to content

Commit 4ba54fa

Browse files
rootroot
root
authored and
root
committed
Apply fix from PR #228 to parsing module
1 parent 61356f0 commit 4ba54fa

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

sim-cli/src/parsing.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,19 @@ async fn validate_activities(
319319
Ok(validated_activities)
320320
}
321321

322-
pub async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
323-
let sim_path = if sim_file.is_relative() {
324-
data_dir.join(sim_file)
325-
} else {
326-
sim_file
327-
};
328-
329-
if sim_path.exists() {
330-
Ok(sim_path)
322+
async fn read_sim_path(data_dir: PathBuf, sim_file: PathBuf) -> anyhow::Result<PathBuf> {
323+
if sim_file.exists() {
324+
Ok(sim_file)
325+
} else if sim_file.is_relative() {
326+
let sim_path = data_dir.join(sim_file);
327+
if sim_path.exists() {
328+
Ok(sim_path)
329+
} else {
330+
log::info!("Simulation file '{}' does not exist.", sim_path.display());
331+
select_sim_file(data_dir).await
332+
}
331333
} else {
332-
log::info!("Simulation file '{}' does not exist.", sim_path.display());
334+
log::info!("Simulation file '{}' does not exist.", sim_file.display());
333335
select_sim_file(data_dir).await
334336
}
335337
}

0 commit comments

Comments
 (0)