using the variables script in our bootstrap, since otherwise PERLLIB isn't set yet.
[feisty_meow.git] / scripts / core / variables.sh
index 36069c07b3f62f2a20b891b73baaf6c1645d43d8..85fc0bbc4e6eb37d0d34c8e3ec9834933757aa3f 100644 (file)
@@ -86,6 +86,10 @@ fi
 
 # pull in the custom overrides for feisty_meow scripts.
 for i in $FEISTY_MEOW_GENERATED/custom/*.sh; do
+  if [ ! -f "$i" ]; then
+    # skip it if it's not real.
+    continue;
+  fi
   if [ ! -z "$SHELL_DEBUG" ]; then
     echo "loading customization: $(basename $(dirname $i))/$(basename $i)"
   fi
@@ -103,16 +107,23 @@ export PERLLIB
 if [ "$OS" != "Windows_NT" ]; then
   PERLLIB+="/usr/lib/perl5"
 else
-#echo "the scripts dir is $FEISTY_MEOW_SCRIPTS"
-  FEISTY_MEOW_SCRIPTS="$(echo $FEISTY_MEOW_SCRIPTS | sed -e 's/\\/\//g')"
-  FEISTY_MEOW_SCRIPTS="$FEISTY_MEOW_SCRIPTS"
-#echo "the scripts dir is now $FEISTY_MEOW_SCRIPTS"
   export PERLIO=:perlio
-    # choose perl's IO over the system's so we can handle file bytes exactly.
+    # choose perl's IO over the ms-windows version so we can handle file
+    # bytes properly.
 fi
 
-#make this automatic!
-PERLLIB+=":$FEISTY_MEOW_SCRIPTS/core:$FEISTY_MEOW_SCRIPTS/text:$FEISTY_MEOW_SCRIPTS/files:$FEISTY_MEOW_SCRIPTS/archival"
+# iterate across our sub-directories and find the perl scripts.
+# this currently only looks one level down.
+for i in $FEISTY_MEOW_SCRIPTS/*; do
+  if [ -d "$i" ]; then
+    # check if there is a perl file present; add the folder to PERLLIB if so.
+    ls $i/*.pl &>/dev/null
+    if [ $? -eq 0 ]; then
+      PERLLIB+=":$i"
+    fi
+  fi
+done
+#echo PERLLIB is now $PERLLIB
 
 # set this so nechung can find its data.
 export NECHUNG=$LIBDIR/database/fortunes.dat