Permalink
Browse files

Fixed directory resolver and prepend_modules_dir functions

  • Loading branch information...
1 parent 482da0e commit 6393820bf7d1feb81821596e6bc27f3db57c05c6 @bellthoven committed Mar 14, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/bang.sh
View
@@ -2,7 +2,7 @@
# BASH_SOURCE - BASH_ARGV - BASH_LINENO - FUNCNAME
_BANG_PATH="$(dirname $(realpath ${BASH_ARGV[0]}))"
-_BANG_MODULE_DIRS=("$_BANG_PATH/modules" "./modules")
+_BANG_MODULE_DIRS=("./modules" "$_BANG_PATH/modules")
_BANG_RAISED_EXCEPTION=""
_BANG_DEFAULT_CATCH=""
declare -A _BANG_CATCHED_EXCEPTIONS=()
@@ -25,13 +25,13 @@ function append_module_dir () {
# @param dirname - the path for the desired directory
function prepend_module_dir () {
[ -z "$1" ] && return 1
- _BANG_MODULE_DIRS=("$1" "${_BANG_MODULE_DIRS}")
+ _BANG_MODULE_DIRS=("$1" "${_BANG_MODULE_DIRS[@]}")
}
# Resolves a module name for its path
# @param module - the name of the module
function resolve_module_path () {
- for path in $_BANG_MODULE_DIRS; do
+ for path in "${_BANG_MODULE_DIRS[@]}"; do
path=$(realpath "$path")
[ -r "$path/$1.sh" ] && echo "$path/$1.sh" && return 0
done

0 comments on commit 6393820

Please sign in to comment.