From d1a5eefb7abb56eaf355374e2caa5242f1ff821a Mon Sep 17 00:00:00 2001 From: ge Date: Sat, 14 May 2022 21:13:27 +0300 Subject: [PATCH] feat: Add __main_target path verification --- src/lib/source.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/source.sh b/src/lib/source.sh index 007b555..8d96804 100644 --- a/src/lib/source.sh +++ b/src/lib/source.sh @@ -68,6 +68,15 @@ validate_targets() { # Set __main_target. This variable contains path to save local backups. # Files to additional targets will be coped from this directory. __main_target="${file_targets[0]}" + # Fail if __main_target's path is not a directory + parse_uri "$__main_target" + if [ -d "$path" ]; then + __main_target="$path" + else + echo "Error: Path $path in $__main_target" \ + "is not directory or does not exists" >&2 + exit 1 + fi fi }