Remove `bot:load' in favor of `load-from-path'
authorclinton <clinton@unknownlamer.org>
Thu, 30 Jul 2009 16:54:00 +0000 (16:54 +0000)
committerclinton <clinton@unknownlamer.org>
Thu, 30 Jul 2009 16:54:00 +0000 (16:54 +0000)
* Removed %bot:loadpath and instead push the bobot++ script
  directories onto the global load path
* Removed bot:load definition instead defining it to be an alias for
  load-from-path

scripts/bobot-utils.scm

index e9f8bbc..a3daf87 100644 (file)
 (use-modules (srfi srfi-1)
             (srfi srfi-13))
 
-(define-public %bot:loadpath (list
-                             (string-append (getenv "HOME")
-                                            "/.bobotpp/scripts/")
-                             bot:sys-scripts-dir))
-
-(define-public %bot:load-extensions %load-extensions)
+(set! %load-path (cons* (string-append (getenv "HOME") "/.bobotpp/scripts/")
+                       bot:sys-scripts-dir
+                       %load-path))
 
 ;;; bot:log: Write as many messages as you want to the log.  If the
 ;;; arg is a thunk it will be executed and it's output will be
    messages)
   (bot:flushport))
 
-(define-public (bot:load file)
-  (let path-loop ((load-path %bot:loadpath))
-    (cond ((not (null? load-path))
-          (if (not
-               (let ext-loop ((extensions %bot:load-extensions))
-                 (cond ((not (null? extensions))
-                        (if (catch 'system-error
-                                   (lambda ()
-                                     (load
-                                      (string-append (car load-path)
-                                                     file
-                                                     (car extensions)))
-                                     #t)
-                                   (lambda args
-                                     #f ))
-                            #t
-                            (ext-loop (cdr extensions))))
-                       (else #f))))
-              (path-loop (cdr load-path))))
-         (else
-          (begin (bot:log "ERROR: File " file " Not Found!\n") #f)))))
+(define-public bot:load load-from-path)
 
 (define-public (bot:load-module module-spec)
   (let ((module->string