@@ -5,6 +5,7 @@ import Control.Monad.Error
55import System.Directory (doesFileExist)
66import System.Environment (getEnv)
77import System.FilePath ((</>), replaceExtension)
8+import System.IO.Error (tryIOError)
89import qualified Build.Flags as Flag
910import qualified Build.Print as Print
1011import qualified Paths_Elm as This
@@ -33,8 +34,27 @@ getDataFile name = do
3334 if exists
3435 then return path
3536 else do
36− env <- getEnv "ELM_HOME"
37− return (env </> name)
37+ environment <- tryIOError (getEnv "ELM_HOME")
38+ case environment of
39+ Right env -> return (env </> name)
40+ Left _ ->
41+ fail $ unlines
42+ [ "Unable to find the ELM_HOME environment variable when searching"
43+ , "for the " ++ name ++ " file."
44+ , ""
45+ , "If you installed Elm Platform with the Mac or Windows installer, it looks like"
46+ , "ELM_HOME was not set automatically. Look up how to set environment variables"
47+ , "on your platform and set ELM_HOME to the directory that contains Elm's static"
48+ , "files:"
49+ , ""
50+ , " * On Mac it is /usr/local/share/elm"
51+ , " * On Windows it is one of the following:"
52+ , " C:/Program Files/Elm Platform/0.12.3/share"
53+ , " C:/Program Files (x86)/Elm Platform/0.12.3/share"
54+ , ""
55+ , "If it seems like a more complex issue, please report it here:"
56+ , " <https://github.com/elm-lang/elm-platform/issues>"
57+ ]
3858
3959run :: ErrorT String IO a -> IO a
4060run command = do