diff --git a/modules/loader.zsh b/modules/loader.zsh index b2e5398..ad52207 100644 --- a/modules/loader.zsh +++ b/modules/loader.zsh @@ -43,10 +43,12 @@ mod_queue() { local module="$1" local modsource="$ZMODPATH/$module" - if [[ "$2" == "is_dep" ]]; then - if ! [ -e "$modsource" ] ; then + if ! mod_exists "$module" ; then + if [[ "$2" == "is_dep" ]]; then echo "$3: Unsatisfied dependency \"$module\""; return 1 + else + return 2 fi fi @@ -62,6 +64,10 @@ mod_queue() { fi } +mod_exists() { + [ -e "$ZMODPATH/$module" ] +} + # Checks for module dependencies # # Reads the "depend" file for a module and tries to queue all dependencies for @@ -106,8 +112,8 @@ mod_check_dep() { "after") if ([ -z "$ZMODLOAD_ONLY" ] \ || in_array "$dep" "${(@)ZMODLOAD_ONLY}") \ - && ! in_array "$dep" "${(@)ZMODLOAD_BLACKLIST}"; then - mod_queue "$dep" is_dep ${modpath}; + && ! in_array "$dep" "${(@)ZMODLOAD_BLACKLIST}"; then + mod_queue "$dep" fi ;; "block") if in_array "$dep" "${(@)ZMODLOAD_ONLY}" \