On Mon, Nov 11, 2019 at 08:57:11PM +0100, Peter Bex wrote:
> I actually prefer it the "cd /d" way, because then we can't accidentally
> forget to introduce this elsewhere: we can just call cd-command and it
> will work on Windows if it works on UNIX.  The code will be shorter as
> well.  So let's make a new patch.

And here it is.

Cheers,
Peter
From eb85d1392c3a7ca5e4673e6352a55827641db8e5 Mon Sep 17 00:00:00 2001
From: Peter Bex <pe...@more-magic.net>
Date: Fri, 22 Nov 2019 18:33:30 +0100
Subject: [PATCH] Clean up drive changing by using "cd /d" on Windows

This is much simpler and less likely to cause issues in the future
because the explicit change-drive-command is easier to forget when
adding new calls to cd-command, especially because we don't tend to
test on Windows much.  It's also shorter and easier to read.
---
 egg-compile.scm | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index 149f25a9..c18c8c14 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -98,12 +98,10 @@
     ((unix) "rm -f")
     ((windows) "del /f /q")))
 
-(define (cd-command platform) "cd")
-
-(define (change-drive-command platform drive)
+(define (cd-command platform)
   (case platform
-    ((unix) #f)
-    ((windows) drive)))		    ; Should already include the colon
+    ((unix) "cd")
+    ((windows) "cd /d")))
 
 (define (uses-compiled-import-library? mode)
   (not (and (eq? mode 'host) staticbuild)))
@@ -1090,10 +1088,6 @@
     (with-output-to-file dest
       (lambda ()
         (prefix platform)
-        (receive (drive root parts) (decompose-directory srcdir)
-          (let ((cmd (change-drive-command platform drive)))
-            (when cmd
-              (print cmd))))
         (print (cd-command platform) " " (qs* srcdir platform #t))
         (for-each
           (lambda (cmd) (cmd srcdir platform))
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to