~ chicken-core (chicken-5) 6e554718b5a398b0154f061c34d920bd81eca60c


commit 6e554718b5a398b0154f061c34d920bd81eca60c
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Sun Feb 21 13:38:37 2016 +0100
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Mon Feb 22 09:10:50 2016 +1300

    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).
    
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/chicken-install.scm b/chicken-install.scm
index 5aef05c2..f13a1f46 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
Trap