mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
* boot-9.scm: %load-path is initialized in C code now.
(implementation-vicinity, parse-path): Deleted, along with code to initialize %load-path. * boot-9.scm (in-vicinity): If the vicinity doesn't end with a "/", use one to separate it from the file.
This commit is contained in:
parent
1325feea48
commit
3cab839236
1 changed files with 7 additions and 32 deletions
|
@ -760,42 +760,17 @@
|
|||
;;; {Load Paths}
|
||||
;;;
|
||||
|
||||
(define implementation-vicinity compiled-library-path)
|
||||
|
||||
;;; Here for backward compatability
|
||||
;;
|
||||
(define scheme-file-suffix (lambda () ".scm"))
|
||||
|
||||
(define in-vicinity string-append)
|
||||
|
||||
(define (parse-path env_path)
|
||||
(cond ((string? env_path)
|
||||
(let loop ((curdir "") (env env_path) (path '()))
|
||||
(cond ((= (string-length env) 0)
|
||||
(if (> (string-length curdir) 0)
|
||||
(append path (list curdir))
|
||||
path))
|
||||
((char=? (string-ref env 0) #\:)
|
||||
(loop ""
|
||||
(substring env 1 (string-length env))
|
||||
(append path (list curdir))))
|
||||
(#t
|
||||
(loop (string-append curdir (substring env 0 1))
|
||||
(substring env 1 (string-length env))
|
||||
path)))))
|
||||
(#t '())))
|
||||
|
||||
;;; we don't have false-if-exception (or defmacro) yet.
|
||||
(define %load-path
|
||||
(let ((lp (catch #t (lambda () (getenv "SCHEME_LOAD_PATH"))
|
||||
(lambda args #f))))
|
||||
(append
|
||||
(parse-path lp)
|
||||
(cons "./"
|
||||
(map (lambda (dir) (in-vicinity (implementation-vicinity) dir "/"))
|
||||
(cons "site"
|
||||
(map (lambda (dir) (string-append (version) "/" dir))
|
||||
'("." "gls/guile" "gls" "slib"))))))))
|
||||
(define (in-vicinity vicinity file)
|
||||
(let ((tail (let ((len (string-length vicinity)))
|
||||
(if (zero? len) #f
|
||||
(string-ref vicinity (- len 1))))))
|
||||
(string-append vicinity
|
||||
(if (eq? tail #\/) "" "/")
|
||||
file)))
|
||||
|
||||
|
||||
;;; {try-load}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue