zsh:conf: Remove trailing slashes before processing

Previously when the program name had a trailing slash, `conf` would not
find the right file as it would check for filenames that include a slash
(e.g. `prog/rc`). This was especially annoying, since conf's completion
function inserts a slash automatically when subdirectories exists.
This commit is contained in:
2025-05-14 18:08:19 +02:00
parent 0e4cf4f947
commit 6d5245a56e

View File

@@ -90,6 +90,10 @@ conf() {
printf "\033[1;31mPlease specify a config.\n\033[0m" >&2 printf "\033[1;31mPlease specify a config.\n\033[0m" >&2
return 1 return 1
fi fi
# remove trailing slashes
1="${(*)1%%/#}"
# search for program name in XDG_CONFIG_HOME and $HOME # search for program name in XDG_CONFIG_HOME and $HOME
local CONF_DIR="$(_get_config_dir "$1")" local CONF_DIR="$(_get_config_dir "$1")"
if (( $? )); then if (( $? )); then