From 15c2f8664008f55c96bf2137dae5fa1e4c4d2ee4 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sun, 21 Feb 2016 13:38:37 +0100 Subject: [PATCH] Fix module db generation on Windows. On Windows, the generated pathname for the glob in update-db would consist of slashes, but the final directory name would contain a backslash between the binary version and the filename. The regular expression which extracted the module name from the full path to the import file only matched on slashes, causing the backslash to be included in the module name. Instead of regexes, we now use platform-aware path manipulation procedures which honour the system's separator character(s). --- chicken-install.scm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/chicken-install.scm b/chicken-install.scm index 5aef05c..f13a1f4 100644 --- a/chicken-install.scm +++ b/chicken-install.scm @@ -681,20 +681,22 @@ (remove-directory tmpdir)))) (define (update-db) - (let* ((files (glob (make-pathname (repo-path) "*.import.*"))) + (let* ((files (glob (make-pathname (repo-path) "*.import.so") + (make-pathname (repo-path) "*.import.scm"))) (tmpdir (create-temporary-directory)) - (dbfile (make-pathname tmpdir +module-db+)) - (rx (irregex ".*/([^/]+)\\.import\\.(scm|so)"))) + (dbfile (make-pathname tmpdir +module-db+))) (print "loading import libraries ...") (fluid-let ((##sys#warnings-enabled #f)) (for-each - (lambda (f) - (let ((m (irregex-match rx f))) + (lambda (path) + (let* ((file (pathname-strip-directory path)) + (import-name (pathname-strip-extension file)) + (module-name (pathname-strip-extension import-name))) (handle-exceptions ex (print-error-message ex (current-error-port) - (sprintf "Failed to import from `~a'" f)) - (eval `(import ,(string->symbol (irregex-match-substring m 1))))))) + (sprintf "Failed to import from `~a'" file)) + (eval `(import ,(string->symbol module-name)))))) files)) (print "generating database") (let ((db -- 2.1.4