From 56192427b4177960c276ff81b0114b6d1e1d4a6f Mon Sep 17 00:00:00 2001 From: th33xitus Date: Mon, 31 Oct 2022 15:55:12 +0100 Subject: [PATCH] refactor: check if folder exists before writing to paths Signed-off-by: Dominik Willner --- scripts/utilities.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/utilities.sh b/scripts/utilities.sh index 1855467..5c3a6ed 100644 --- a/scripts/utilities.sh +++ b/scripts/utilities.sh @@ -597,7 +597,9 @@ function set_multi_instance_names() { local name local names="" - local services=$(find_klipper_systemd) + local services + + services=$(find_klipper_systemd) ### # if value of 'multi_instance_names' is not an empty @@ -706,9 +708,10 @@ function get_instance_folder_path() { fi done elif [[ -z ${instance_names} && $(find_klipper_systemd | wc -w) -gt 0 ]]; then - folder_paths+=("${HOME}/printer_data/${folder_name}") - else - folder_paths=() + path="${HOME}/printer_data/${folder_name}" + if [[ -d ${path} ]]; then + folder_paths+=("${path}") + fi fi echo "${folder_paths[@]}"