diff options
-rw-r--r-- | src/prokit.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/prokit.sh b/src/prokit.sh index 1eec0ef..5679e33 100644 --- a/src/prokit.sh +++ b/src/prokit.sh @@ -34,9 +34,16 @@ OPTSTRING='hV' use() { local module="${1}" + local dir= - if [ -f "${PKGDATADIR}/${module}.sm" ]; then - . "${PKGDATADIR}/${module}.sm" + if [ -f "${0%/*}/../lib/output.sm" ]; then + dir="${0%/*}/../lib" + else + dir="${PKGDATADIR}" + fi + + if [ -f "${dir}/${module}.sm" ]; then + . "${dir}/${module}.sm" else printf '%s: Error: Failed to load module "%s": %s\n' \ "${0##*/}" "${module}" 'no such file or directory' >&2 |