diff --git a/src/utils/fs.rs b/src/utils/fs.rs index bb6a88d..2acac29 100644 --- a/src/utils/fs.rs +++ b/src/utils/fs.rs @@ -19,7 +19,13 @@ pub fn is_path_stdin(path: &Path) -> bool { path.as_os_str() == "-" } -/// Check if &Path exists, if it does then ask the user if they want to overwrite or rename it +/// Check if &Path exists, if it does then ask the user if they want to overwrite or rename it. +/// If the user want to overwrite then the file or directory will be removed and returned the same input path +/// If the user want to rename then nothing will be removed and a new path will be returned with a new name +/// +/// * `Ok(None)` means the user wants to cancel the operation +/// * `Ok(Some(path))` returns a valid PathBuf without any another file or directory with the same name +/// * `Err(_)` is an error pub fn resolve_path_conflict(path: &Path, question_policy: QuestionPolicy) -> crate::Result> { if path.exists() { match user_wants_to_overwrite(path, question_policy)? {