diff --git a/src/main.rs b/src/main.rs index c098100..d9a5d1c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,7 +44,7 @@ mod oxrl; mod validation; use std::{ - env, + env::{self, current_dir}, error::Error, ffi::OsStr, fs, @@ -61,6 +61,26 @@ macro_rules! main_err { }; } +/** + * Returns the path to the parent dir of the argument, + * if it has one. + * We use this rather complex way of doing it, + * because with a simple `file_path.parent()?.exists()`, + * we would get `false` in case of `"bla.txt"`, + * even if CWD is an existing directory. + */ +fn get_parent
(file_path: P) -> Option