From 5797c693c47bb25cfa273b4e7fa8eaebefdb54c9 Mon Sep 17 00:00:00 2001 From: Kyattsukuro Date: Fri, 27 Mar 2026 23:22:23 +0100 Subject: [PATCH] rewrite to abolute paths --- run.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 06de5b4..00e57cb 100755 --- a/run.sh +++ b/run.sh @@ -2,6 +2,25 @@ SCRIPT_DIR="$HOME/.config/fledermaus-formatter" +to_absolute_args() { + local result=() + + for arg in "$@"; do + if [ -e "$arg" ] || [ -d "$arg" ] || [ -f "$arg" ]; then + result+=("$(realpath "$arg")") + else + result+=("$arg") + fi + done + + printf '%s\n' "${result[@]}" +} + +ABS_ARGS=() +while IFS= read -r line; do + ABS_ARGS+=("$line") +done < <(to_absolute_args "$@") + cd $SCRIPT_DIR source $SCRIPT_DIR/.venv/bin/activate -$SCRIPT_DIR/.venv/bin/python3 __init__.py $@ \ No newline at end of file +$SCRIPT_DIR/.venv/bin/python3 __init__.py "${ABS_ARGS[@]}" \ No newline at end of file