From f06b64690bc8c823065808a08d66ed8d59304f9d Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 26 Oct 2019 22:50:52 -0700 Subject: [PATCH] Automatically pre-register libraries in standard places. --- src/runtime/library-loader.scm | 13 +++++++++++++ src/runtime/make.scm | 1 + 2 files changed, 14 insertions(+) diff --git a/src/runtime/library-loader.scm b/src/runtime/library-loader.scm index 7dd55fbef..7f284a4e1 100644 --- a/src/runtime/library-loader.scm +++ b/src/runtime/library-loader.scm @@ -196,6 +196,19 @@ USA. (error "Not an exported name:" name)) (cdr p)))))) +(define (preregister-standard-libraries!) + (parameterize ((param:hide-notifications? #t)) + (let ((pn (system-library-directory-pathname "libraries"))) + (if pn + (find-scheme-libraries! pn))) + (let ((pn (init-file-specifier->pathname '("libraries")))) + (if (file-directory? pn) + (find-scheme-libraries! (pathname-as-directory pn)))))) + +(add-boot-init! + (lambda () + (add-event-receiver! event:after-restart preregister-standard-libraries!))) + (define (find-scheme-libraries! pathname) (preregister-libraries! pathname (current-library-db))) diff --git a/src/runtime/make.scm b/src/runtime/make.scm index 1dd45290b..66043d718 100644 --- a/src/runtime/make.scm +++ b/src/runtime/make.scm @@ -478,6 +478,7 @@ USA. (runtime hash) (runtime dynamic) (runtime regular-sexpression) + (runtime library loader) (runtime library standard) ;; Microcode data structures (runtime history) -- 2.25.1