Fix edit script

This commit is contained in:
Tobias Reisinger 2023-12-16 20:38:07 +01:00
parent 9a0276e495
commit 0eed077cc2
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE

View file

@ -2,7 +2,7 @@
set -e set -e
edit_dir_base="$XDG_RUNTIME_DIR/edit/" edit_dir_base="$XDG_RUNTIME_DIR/edit"
_pre_checks() { _pre_checks() {
if [ -z "$EDITOR" ]; then if [ -z "$EDITOR" ]; then
@ -30,7 +30,7 @@ _get_edit_directory() {
target_dir=$(dirname "$1") target_dir=$(dirname "$1")
edit_dir_sub=$(_readlink "$target_dir" | md5sum | awk '{ print $1 }') edit_dir_sub=$(_readlink "$target_dir" | md5sum | awk '{ print $1 }')
edit_directory="$edit_dir_base/$edit_dir_sub/" edit_directory="$edit_dir_base/$edit_dir_sub"
echo "$edit_directory" echo "$edit_directory"
} }
@ -39,7 +39,7 @@ _get_edit_file() {
target_name=$(basename "$target") target_name=$(basename "$target")
edit_directory=$(_get_edit_directory "$target") edit_directory=$(_get_edit_directory "$target")
edit_file=$(realpath -s "$edit_directory/$target_name") edit_file="$edit_directory/$target_name"
echo "$edit_file" echo "$edit_file"
} }