]> git.donarmstrong.com Git - infobot.git/blobdiff - blootbot
ws
[infobot.git] / blootbot
index 71efd335e7cef348c67882db602734c83b63c7be..323c12258666972ed11be3e63357591cd4cdc158 100755 (executable)
--- a/blootbot
+++ b/blootbot
@@ -4,22 +4,31 @@
 # blootbot -- copyright david sobon (c) 1999-infinity
 
 use strict;
-use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir
+use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir
+           $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir
            $bot_pid $memusage %param
 );
 
 BEGIN {
-    # set this to the absolute path if you need it; especially
-    # if . is not in your path
+    if (@ARGV and -f $ARGV[0]) {
+       # source passed config to allow $bot_*_dir to be set.
+       do $ARGV[0];
+    }
+
+    # set any $bot_*_dir var's that aren't already set
+    $bot_base_dir      ||= '.';
+    $bot_config_dir    ||= 'files/';
+    $bot_data_dir      ||= 'files/';
+    $bot_state_dir     ||= 'files/';
+    $bot_run_dir       ||= '.';
+    $bot_src_dir       ||= "$bot_base_dir/src";
+    $bot_log_dir       ||= "$bot_base_dir/log";
+    $bot_misc_dir      ||= "$bot_base_dir/files";
 
-    $bot_base_dir      = '.';
-    $bot_src_dir       = "$bot_base_dir/src";
-    $bot_misc_dir      = "$bot_base_dir/files";
     $bot_pid           = $$;
 
     require "$bot_src_dir/logger.pl";
     require "$bot_src_dir/core.pl";
-    require "$bot_src_dir/interface.pl";
     require "$bot_src_dir/modules.pl";
 
     # load the configuration (params) file.
@@ -38,7 +47,7 @@ BEGIN {
 # prevent duplicate processes of the same bot
 &duperuncheck();
 
-# initialize everything 
+# initialize everything
 &startup();    # first time initialization.
 &setup();