[MLton-commit] r6698

Wesley Terpstra wesley at mlton.org
Fri Aug 8 09:03:09 PDT 2008


Fixed mlton.bat so that it can work in a directory with spaces.
eg: C:\Program Files\MLton


----------------------------------------------------------------------

U   mlton/trunk/package/mingw/mlton.bat

----------------------------------------------------------------------

Modified: mlton/trunk/package/mingw/mlton.bat
===================================================================
--- mlton/trunk/package/mingw/mlton.bat	2008-08-08 16:00:07 UTC (rev 6697)
+++ mlton/trunk/package/mingw/mlton.bat	2008-08-08 16:03:08 UTC (rev 6698)
@@ -1,30 +1,35 @@
 @echo off
-if "%CMDEXTVERSION%"=="" goto :downlevel
+if "%CMDEXTVERSION%"=="" (
+  echo Batch file execution of MLton not supported without command extensions
+  goto :eof
+)
 
-rem %0 contains the name of this batch file, before the path was searched
-rem But we can use the %~dp0 call-parameter syntax to find out what drive and directory it lives on
 setlocal
-call :setdir %~dp0 "%*"
 
-if not exist %dir% (
-  echo MLton directory %dir% does not exist
-  goto :end
+rem Use magic from the internet to get the parent directory
+for %%? in ("%~dp0..") do set dir=%%~f?
+set lib=%dir%\lib\MLton
+set bin=%dir%\bin
+
+
+if not exist "%bin%" (
+  echo MLton directory %bin% does not exist
+  goto :eof
 ) 
 
-set lib=%dir%..\lib\MLton
-if not exist %lib% (
+if not exist "%lib%" (
   echo MLton library directory %lib% does not exist
-  goto :end
+  goto :eof
 )
 
-set cc=%dir%gcc.exe
-if not exist %cc% (
+set cc=%bin%\gcc.exe
+if not exist "%cc%" (
   echo GCC compiler %cc% does not exist
-  goto :end
+  goto :eof
 )
 
 rem gcc needs to be pathed to find as, ld, etc
-set PATH=%dir%;%PATH%
+set PATH=%bin%;%PATH%
 
 set world=%lib%\world.mlton
 set mlton=%lib%\mlton-compile.exe
@@ -34,15 +39,4 @@
 set ccopts=%ccopts% -malign-functions=5 -malign-jumps=2 -malign-loops=2
 set linkopts=-lm -lgmp -lws2_32 -lkernel32 -lpsapi -lnetapi32
 
-%mlton% @MLton load-world %world% ram-slop 0.5 -- %lib% -cc %cc% -cc-opt-quote "-I%lib%\include" -cc-opt "%ccopts%" -mlb-path-map "%lib%\mlb-path-map" -link-opt "%linkopts%" %*
-goto :eof
-
-:setdir
-set dir=%1%
-GOTO :eof
-
-:downlevel
-echo Batch file execution of MLton not supported without command extensions
-goto :end
-
-:end
+"%mlton%" @MLton load-world "%world%" ram-slop 0.5 -- "%lib%" -cc "%cc%" -cc-opt-quote "-I%lib%\include" -cc-opt "%ccopts%" -mlb-path-map "%lib%\mlb-path-map" -link-opt "%linkopts%" %*




More information about the MLton-commit mailing list