~ chicken-core (chicken-5) 8c9905a87896f84daafc05321dc7f0a53a5e7176


commit 8c9905a87896f84daafc05321dc7f0a53a5e7176
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:20:52 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 7a30cbcc..67088a97 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -693,20 +693,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