From 8fcf7135416dc85e305cb4857cbb696560eb16d3 Mon Sep 17 00:00:00 2001 From: cornfeedhobo Date: Sun, 31 Jan 2021 15:32:23 -0600 Subject: [PATCH] use absolute paths instead of changing directory --- scripts/reloader.bash | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/reloader.bash b/scripts/reloader.bash index e5fb4e39..f22de67e 100644 --- a/scripts/reloader.bash +++ b/scripts/reloader.bash @@ -1,6 +1,5 @@ #!/bin/bash BASH_IT_LOG_PREFIX="core: reloader: " -pushd "${BASH_IT}" >/dev/null || exit 1 function _set-prefix-based-on-path() { @@ -9,7 +8,7 @@ function _set-prefix-based-on-path() BASH_IT_LOG_PREFIX="$extension: $filename: " } -if [ "$1" != "skip" ] && [ -d "./enabled" ]; then +if [[ "$1" != "skip" ]] && [[ -d "$BASH_IT/enabled" ]]; then _bash_it_config_type="" case $1 in @@ -20,7 +19,7 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then _log_debug "Loading all enabled components..." ;; esac - for _bash_it_config_file in $(sort <(compgen -G "./enabled/*${_bash_it_config_type}.bash")); do + for _bash_it_config_file in $(sort <(compgen -G "$BASH_IT/enabled/*${_bash_it_config_type}.bash")); do if [ -e "${_bash_it_config_file}" ]; then _set-prefix-based-on-path "${_bash_it_config_file}" _log_debug "Loading component..." @@ -32,12 +31,12 @@ if [ "$1" != "skip" ] && [ -d "./enabled" ]; then done fi -if [ -n "${2}" ] && [ -d "${2}/enabled" ]; then +if [[ -n "${2}" ]] && [[ -d "$BASH_IT/${2}/enabled" ]]; then case $2 in aliases|completion|plugins) _log_warning "Using legacy enabling for $2, please update your bash-it version and migrate" - for _bash_it_config_file in $(sort <(compgen -G "./${2}/enabled/*.bash")); do - if [ -e "$_bash_it_config_file" ]; then + for _bash_it_config_file in $(sort <(compgen -G "$BASH_IT/${2}/enabled/*.bash")); do + if [[ -e "$_bash_it_config_file" ]]; then _set-prefix-based-on-path "${_bash_it_config_file}" _log_debug "Loading component..." # shellcheck source=/dev/null @@ -51,4 +50,3 @@ fi unset _bash_it_config_file unset _bash_it_config_type -popd >/dev/null || exit 1