More un-hardcoding
[bpt/mlt.git] / src / compiler.sml
index 6e31f5a..16d66f8 100644 (file)
@@ -21,6 +21,8 @@
 
 structure Compiler :> COMPILER =
 struct
+    open Settings
+
     exception Error
 
     val cgiMode = Posix.FileSys.S.flags [Posix.FileSys.S.irwxu,
@@ -112,8 +114,8 @@ struct
 
            fun loop (smls, mlts) =
                (case Posix.FileSys.readdir dir of
-                    "" => (smls, mlts)
-                  | fname =>
+                    NONE => (smls, mlts)
+                  | SOME fname =>
                     (case getExt fname of
                          "mlt" => loop (smls, (path ^ "/" ^ fname) :: mlts)
                        | ("sml"|"sig") =>
@@ -169,7 +171,6 @@ struct
            val outPath = Config.outPath config 
            val pubPath = Config.pubPath config
            val sml = Config.sml config
-           val arch = "x86-linux"
 
            val loc = Environment.staticPart (#get (EnvRef.loc ()) ())
            val base = Environment.staticPart (#get (EnvRef.base ()) ())
@@ -242,7 +243,7 @@ struct
            val _ = TextIO.closeOut outf
 
            val outf = TextIO.openOut (outPath ^ "/.build.sml")
-           val _ = TextIO.output (outf, "Control.printWarnings := false;\nCM.make \"sources.cm\";\nSMLofNJ.exportFn (\"" ^ outPath ^ "/heap\", Main.main);\n")
+           val _ = TextIO.output (outf, "Control.printWarnings := false;\nprint \"Here we go\"\n;\nCM.make \"sources.cm\";\nSMLofNJ.exportFn (\"" ^ outPath ^ "/heap\", Main.main);\n")
            val _ = TextIO.closeOut outf
 
            val outf = TextIO.openOut (outPath ^ "/sources.cm")
@@ -272,7 +273,7 @@ struct
                 printNames outputs;
                 TextIO.output (outf, "\n\t(* Driver *)\n\n\t_main.sml\n");
                 TextIO.closeOut outf;
-                if OS.Process.system ("cat " ^ outPath ^ "/.build.sml | " ^ sml ^ "/sml") = OS.Process.success then
+                if OS.Process.system ("cd " ^ outPath ^ " ; cat .build.sml | " ^ sml ^ "/sml") = OS.Process.success then
                     (ListPair.app makeScript (scripts, exports);
                      OS.Process.success)
                 else