feat: Add __main_target path verification

This commit is contained in:
ge 2022-05-14 21:13:27 +03:00
parent d2e882f1ec
commit d1a5eefb7a

View File

@ -68,6 +68,15 @@ validate_targets() {
# Set __main_target. This variable contains path to save local backups. # Set __main_target. This variable contains path to save local backups.
# Files to additional targets will be coped from this directory. # Files to additional targets will be coped from this directory.
__main_target="${file_targets[0]}" __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 fi
} }