Subject: bug#10474: Building guile 2.x under mingw + msys

From: Eli Zaretskii <[email-masked]>
Date: Wed, 20 Feb 2013 21:16:23 +0200

> From: Andy Wingo <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Tue, 19 Feb 2013 22:44:39 +0100
> 
> >>    (define (canonical->suffix canon)
> >>      (cond
> >> -     ((string-prefix? "/" canon) canon)
> >> -     ((and (> (string-length canon) 2)
> >> -           (eqv? (string-ref canon 1) #\:))
> >> -      ;; Paths like C:... transform to /C...
> >> -      (string-append "/" (substring canon 0 1) (substring canon 2)))
> >> +     ((and (not (string-null? canon))
> >> +           (path-separator? (string-ref canon 0)))
> >> +      canon)
> >> +     ((and (eq? (system-path-convention) 'windows)
> >> +           (absolute-path? canon))
> >> +      ;; An absolute path that doesn't start with a path separator starts with a
> >> +      ;; drive component.  Transform the drive component to a path element:
> >> +      ;; c:\foo -> \c\foo.
> >
> > Why is this transformation needed?  Native Windows system calls will
> > not understand "/c/foo" syntax.  What is this about?  (I know it was
> > in the original code, but I didn't understand it then, either.)
> 
> Auto-compiling /foo/bar/baz.scm produces
> $HOME/.cache/guile/2.0/ccache/foo/bar/baz.go.  This turns the drive
> component into a path element on Windows so compiling C:/foo.scm caches
> $HOME/.cache/guile/2.0/ccache/c/foo.go.

Thanks, I see the light now.  Perhaps consider adding a comment there
pointing to this use of the transformation.