From fd183090070f9a5cae9ae10121fa3aa003625703 Mon Sep 17 00:00:00 2001 From: clinton Date: Thu, 30 Jul 2009 16:54:00 +0000 Subject: [PATCH] Remove `bot:load' in favor of `load-from-path' * 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 | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/scripts/bobot-utils.scm b/scripts/bobot-utils.scm index e9f8bbc..a3daf87 100644 --- a/scripts/bobot-utils.scm +++ b/scripts/bobot-utils.scm @@ -12,12 +12,9 @@ (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 @@ -31,27 +28,7 @@ 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 -- 2.20.1