[MLton-commit] r7474
Matthew Fluet
fluet at mlton.org
Fri May 28 11:00:53 PDT 2010
Cygwin 1.7 only likes unix-style paths.
----------------------------------------------------------------------
U mlton/trunk/basis-library/system/path.sml
D mlton/trunk/regression/filesys.x86-cygwin.ok
D mlton/trunk/regression/unixpath.x86-cygwin.ok
----------------------------------------------------------------------
Modified: mlton/trunk/basis-library/system/path.sml
===================================================================
--- mlton/trunk/basis-library/system/path.sml 2010-05-28 18:00:11 UTC (rev 7473)
+++ mlton/trunk/basis-library/system/path.sml 2010-05-28 18:00:53 UTC (rev 7474)
@@ -24,42 +24,18 @@
val op sub = String.sub
val substring = String.extract
-(* Testing commands in both cygwin and mingw reveal that BOTH treat
- * paths exactly the same, and they also match newer windows console
- * commands (for example command.com and cmd.exe).
- *
- * There is one exception: both cygwin and mingw treat /foo\bar
- * differently from \foo\bar; there is a special root for '/'.
- * This is so that cygwin and msys can fake a Unix directory tree.
- *
- * Normal windows commands do not do this. Both msys and cygwin do it
- * differently. The msys(mingw) approach is for the shell(bash) to
- * translate the path before calling the command, eg: foo /usr will
- * run foo with arguement "c:/msys/1.0/". Under cygwin, the path is
- * passed through as stated and the program has to deal with it. Thus,
- * for mingw we can (and should) ignore the issue and thus the mlton
- * compiled application is identical to a windows app. However, under
- * cygwin, we need to track /* as a special volume.
- *)
val isWindows =
let
open Primitive.MLton.Platform.OS
in
- host = MinGW orelse host = Cygwin
+ host = MinGW
end
-val volumeHack =
- let
- open Primitive.MLton.Platform.OS
- in
- host = Cygwin
- end
-
(* the path separator used in canonical paths *)
val slash = if isWindows then "\\" else "/"
-(* newer windows commands treat both / and \ as path separators
- * try echo sdfsdf > foo/bar under windows command.com -- it works
+(* MinGW and newer Windows commands treat both / and \ as path
+ * separators.
*
* Sadly this means that toString o fromString is not the identity
* b/c foo/bar -> foo\bar. However, there's nothing else one can do!
@@ -68,13 +44,9 @@
fun isslash c = c = #"/" orelse (isWindows andalso c = #"\\")
fun iscolon c = c = #":"
-(* Under cygwin, the special volume "/" denotes the cygwin pseudo-root
- *)
fun isVolumeName v =
(isWindows andalso size v = 2 andalso
Char.isAlpha (v sub 0) andalso iscolon (v sub 1))
- orelse
- (volumeHack andalso v = "/")
fun volumeMatch (root, relative) =
relative = ""
@@ -107,10 +79,7 @@
val (vol, rest) = (* 4:foo has a volume of "4:" even tho invalid *)
if isWindows andalso size s >= 2 andalso iscolon (s sub 1)
then (substring (s, 0, SOME 2), substring (s, 2, NONE))
- else
- if volumeHack andalso size s >= 1 andalso s sub 0 = #"/"
- then ("/", s)
- else ("", s)
+ else ("", s)
val (isAbs, arcs) =
case (String.fields isslash rest) of
"" :: [] => (false, [])
@@ -139,7 +108,7 @@
then raise InvalidArc
else
concat [vol,
- if isAbs andalso (not volumeHack orelse vol <> "/")
+ if isAbs
then slash
else "",
String.concatWith slash arcs]
@@ -317,7 +286,7 @@
let
val {arcs, isAbs, vol} = fromString s
in
- if vol <> "" andalso not (volumeHack andalso vol = "/")
+ if vol <> ""
then raise Path
else (if isAbs then "/" else "") ^ String.concatWith "/" arcs
end
Deleted: mlton/trunk/regression/filesys.x86-cygwin.ok
===================================================================
--- mlton/trunk/regression/filesys.x86-cygwin.ok 2010-05-28 18:00:11 UTC (rev 7473)
+++ mlton/trunk/regression/filesys.x86-cygwin.ok 2010-05-28 18:00:53 UTC (rev 7474)
@@ -1,63 +0,0 @@
-
-File filesys.sml: Testing structure FileSys...
-test1a OK
-test1b OK
-test2 OK
-test3a OK
-test4a OK
-test4b OK
-test4c OK
-test4d OK
-test5 OK
-test6a OK
-test6b OK
-test6c OK
-test6d OK
-test6e OK
-test6f OK
-test6g OK
-test6h OK
-test6i OK
-test6j OK
-test6k OK
-test6l OK
-test7a OK
-test7b OK
-test7c OK
-test7d OK
-test7e OK
-test8a WRONG
-test8b WRONG
-test8c OK
-test8d OK
-test8e OK
-test8f OK
-test8g OK
-test8h OK
-test9a OK
-test9b OK
-test10a OK
-test10b OK
-test10c OK
-test11a OK
-test11b OK
-test11c OK
-test12a OK
-test12b OK
-test12c OK
-test13a OK
-test13b OK
-test13c OK
-test13d OK
-test13e OK
-test14 OK
-test15a OK
-test15b OK
-test15b1 OK
-test15b2 OK
-test15b3 OK
-test15c OK
-test15d OK
-test15e OK
-test15f OK
-test15g OK
Deleted: mlton/trunk/regression/unixpath.x86-cygwin.ok
===================================================================
--- mlton/trunk/regression/unixpath.x86-cygwin.ok 2010-05-28 18:00:11 UTC (rev 7473)
+++ mlton/trunk/regression/unixpath.x86-cygwin.ok 2010-05-28 18:00:53 UTC (rev 7474)
@@ -1,61 +0,0 @@
-
-File unixpath.sml: Testing structure Path...
-test1a OK
-test1b WRONG
-test1c WRONG
-test1d OK
-test1e WRONG
-test1f WRONG
-test1g OK
-test1h OK
-test1i OK
-test1j OK
-test1k OK
-test1l OK
-test1m OK
-test1n OK
-test2a OK
-test2b EXN
-test2c EXN
-test2d OK
-test2e EXN
-test2f EXN
-test2g WRONG
-test2h WRONG
-test2i WRONG
-test2j WRONG
-test2k WRONG
-test2l WRONG
-test2m WRONG
-test2n EXN
-test2o OK
-test2p WRONG
-test3b WRONG
-test3c WRONG
-test3d OK
-test3e OK
-test3f OK
-test3g OK
-test3h WRONG
-test4a OK
-test4b OK
-test5a WRONG
-test6a WRONG
-test6b OK
-test7a WRONG
-test7b OK
-test7c OK
-test8a WRONG
-test8b OK
-test8c OK
-test9a WRONG
-test10a OK
-test11a WRONG
-test12 WRONG
-test13 WRONG
-test14 OK
-test15 WRONG
-test16 OK
-test17 OK
-test18 WRONG
-test19 WRONG
More information about the MLton-commit
mailing list