4 if [ ${NIX_DEBUG:-0} -ge $1 ]; then
13 addToLuaSearchPathWithCustomDelimiter
() {
16 # delete longest match starting from the lua placeholder '?'
17 local topDir
="${absPattern%%\?*}"
19 # export only if the folder exists else LUA_PATH/LUA_CPATH grow too large
20 if [[ ! -d "$topDir" ]]; then return; fi
22 # export only if we haven't already got this dir in the search path
23 if [[ ${!varName-} == *"$absPattern"* ]]; then return; fi
25 export "${varName}=${!varName:+${!varName};}${absPattern}"
31 if [[ ! -d "$dir" ]]; then
32 nix_debug
"$dir not a directory abort"
36 for pattern
in @luapathsearchpaths@
; do
37 addToLuaSearchPathWithCustomDelimiter LUA_PATH
"$PWD/$pattern"
41 for pattern
in @luacpathsearchpaths@
; do
42 addToLuaSearchPathWithCustomDelimiter LUA_CPATH
"$PWD/$pattern"
47 addEnvHooks
"$hostOffset" addToLuaPath