From dee708a8a8f4653df704811ebcd084577f548b65 Mon Sep 17 00:00:00 2001 From: Evan Czaplicki Date: Wed, 20 Apr 2016 16:07:17 -0700 Subject: [PATCH] Get rid of Elm.Utils.getAssets and ELM_HOME --- src/Elm/Utils.hs | 54 ------------------------------------------------ 1 file changed, 54 deletions(-) diff --git a/src/Elm/Utils.hs b/src/Elm/Utils.hs index 15c4c2cd5..6daa673da 100644 --- a/src/Elm/Utils.hs +++ b/src/Elm/Utils.hs @@ -1,9 +1,7 @@ {-# OPTIONS_GHC -Wall #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE MultiParamTypeClasses #-} module Elm.Utils ( (|>), (<|) - , getAsset , run, unwrappedRun , CommandError(..) , isDeclaration @@ -11,16 +9,10 @@ module Elm.Utils import Control.Monad.Except (MonadError, MonadIO, liftIO, throwError) import qualified Data.List as List -import System.Directory (doesFileExist) -import System.Environment (getEnv) import System.Exit (ExitCode(ExitSuccess, ExitFailure)) -import System.FilePath (()) -import System.IO.Error (tryIOError) import System.Process (readProcessWithExitCode) import qualified AST.Pattern as Pattern -import qualified Elm.Compiler.Version as Version -import qualified Elm.Package as Pkg import qualified Parse.Helpers as Parse import qualified Parse.Expression as Parse import qualified Reporting.Annotation as A @@ -103,52 +95,6 @@ missingExe command = --- GET STATIC ASSETS - -{-| Get the absolute path to a data file. If you install with cabal it will look -in a directory generated by cabal. If that is not found, it will look for the -directory pointed to by the environment variable ELM_HOME. --} -getAsset :: String -> (FilePath -> IO FilePath) -> FilePath -> IO FilePath -getAsset project getDataFileName name = - do path <- getDataFileName name - exists <- doesFileExist path - if exists - then return path - else do - environment <- tryIOError (getEnv "ELM_HOME") - case environment of - Right env -> - return (env project name) - - Left _ -> - fail (errorNotFound name) - - -errorNotFound :: FilePath -> String -errorNotFound name = - unlines - [ "Unable to find the ELM_HOME environment variable when searching" - , "for the " ++ name ++ " file." - , "" - , "If you installed Elm Platform with the Mac or Windows installer, it looks like" - , "ELM_HOME was not set automatically. Look up how to set environment variables" - , "on your platform and set ELM_HOME to the directory that contains Elm's static" - , "files:" - , "" - , " * On Mac it is /usr/local/share/elm" - , " * On Windows it is one of the following:" - , " C:/Program Files/Elm Platform/" ++ (Pkg.versionToString Version.version) ++ "/share" - , " C:/Program Files (x86)/Elm Platform/" ++ (Pkg.versionToString Version.version) ++ "/share" - , "" - , "If you installed using npm, you have to set ELM_HOME to a certain directory" - , "of the form .../node_modules/elm/share" - , "" - , "If it seems like a more complex issue, please report it here:" - , " " - ] - - -- DECL CHECKER isDeclaration :: String -> Maybe String