@@ -6,6 +6,7 @@ import Data.List (intersect, intercalate)
6import Data.Maybe (fromMaybe)
6import Data.Maybe (fromMaybe)
7import Data.Version (showVersion)
7import Data.Version (showVersion)
8import System.Console.CmdArgs
8import System.Console.CmdArgs
9import Text.Blaze.Html.Renderer.String (renderHtml)
10import Text.Blaze.Html.Renderer.String (renderHtml)
11import qualified Text.Jasmine as JS
12import qualified Text.Jasmine as JS
@@ -17,6 +18,7 @@ import CompileToJS
17import GenerateHtml
18import GenerateHtml
18import Paths_Elm
19import Paths_Elm
21+import System.IO.Unsafe
22 ELM { make :: Bool
24 ELM { make :: Bool
@@ -68,12 +70,10 @@ fileTo isMini get what jsFiles noscript outputDir rtLoc file = do
68 case ems of
70 case ems of
69 Left err -> putStrLn $ "Error while compiling " ++ file ++ ":\n" ++ err
71 Left err -> putStrLn $ "Error while compiling " ++ file ++ ":\n" ++ err
70 Right ms ->
72 Right ms ->
71− let path = case outputDir of
73+ let path = fromMaybe "" outputDir </> file
72− Nothing -> reverse . tail . dropWhile (/='.') $ reverse file
73− Just dir -> (\s -> dir ++ "/" ++ s) . reverse . takeWhile (/='/') . tail . dropWhile (/='.') $ reverse file
74− js = path ++ ".js"
74+ js = replaceExtension path ".js"
75− html = path ++ ".html"
75+ html = replaceExtension path ".html"
76− in case what of
76+ in case unsafePerformIO (print path) `seq` what of
77 JS -> writeFile js . formatJS $ jss ++ concatMap jsModule ms
77 JS -> writeFile js . formatJS $ jss ++ concatMap jsModule ms
78 HTML -> writeFile html . renderHtml $ modulesToHtml jsStyle "" rtLoc jss noscript ms
78 HTML -> writeFile html . renderHtml $ modulesToHtml jsStyle "" rtLoc jss noscript ms
79 Split -> do
79 Split -> do
@@ -105,10 +105,10 @@ toFilePath :: String -> FilePath
105toFilePath modul = map (\c -> if c == '.' then '/' else c) modul ++ ".elm"
105toFilePath modul = map (\c -> if c == '.' then '/' else c) modul ++ ".elm"
107builtInModules =
107builtInModules =
108− concat [ [ "List", "Char", "Maybe", "Dict", "Set", "Automaton" ]
108+ concat [ [ "List", "Char", "Maybe", "Dict", "Set", "Automaton", "Date" ]
109 , [ "Signal", "Mouse", "Keyboard.Raw"
109 , [ "Signal", "Mouse", "Keyboard.Raw"
110 , "Window", "Time", "HTTP", "Input", "Random" ]
110 , "Window", "Time", "HTTP", "Input", "Random" ]
111 , [ "Graphics", "Text", "Color" ]
111 , [ "Graphics", "Text", "Color" ]
112− , map ("JavaScript"++) [ "", "Experimental" ]
112+ , map ("JavaScript"++) [ "", ".Experimental" ]
113 , [ "Prelude", "JSON" ]
113 , [ "Prelude", "JSON" ]