diff options
-rw-r--r-- | subplotlib/src/steplibrary/files.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/subplotlib/src/steplibrary/files.rs b/subplotlib/src/steplibrary/files.rs index 8ba27cf..169111d 100644 --- a/subplotlib/src/steplibrary/files.rs +++ b/subplotlib/src/steplibrary/files.rs @@ -269,7 +269,12 @@ pub fn remove_directory(context: &Datadir, path: &str) { #[step] pub fn path_exists(context: &Datadir, path: &str) { let full_path = context.canonicalise_filename(path)?; - fs::metadata(full_path)?; + if !fs::metadata(&full_path)?.is_dir() { + throw!(format!( + "{} exists but is not a directory", + full_path.display() + )) + } } #[step] |