1{-# OPTIONS_GHC -Wall #-}
20import qualified System.Directory as Dir
21import qualified System.Environment as Env
22import qualified System.FilePath as FP
23import System.FilePath ((</>), (<.>))
25import qualified Elm.ModuleName as ModuleName
26import qualified Elm.Package as Pkg
27import qualified Elm.Version as V
36 "elm-stuff" </> compilerVersion
54prepublishDir :: FilePath
56 stuff </> "prepublish"
59compilerVersion :: FilePath
68elmi :: FilePath -> ModuleName.Raw -> FilePath
70 toArtifactPath root name "elmi"
73elmo :: FilePath -> ModuleName.Raw -> FilePath
75 toArtifactPath root name "elmo"
78toArtifactPath :: FilePath -> ModuleName.Raw -> String -> FilePath
79toArtifactPath root name ext =
80 root </> stuff </> ModuleName.toHyphenPath name <.> ext
87temp :: String -> FilePath
89 stuff </> "temp" <.> ext
96getRoot :: IO (Maybe FilePath)
98 do dir <- Dir.getCurrentDirectory
99 getRootHelp (FP.splitDirectories dir)
102getRootHelp :: [String] -> IO (Maybe FilePath)
109 do exists_ <- Dir.doesFileExist (FP.joinPath dirs </> "elm.json")
111 then return (Just (FP.joinPath dirs))
112 else getRootHelp (init dirs)
119newtype PackageCache = PackageCache FilePath
122getPackageCache :: IO PackageCache
124 PackageCache <$> getCacheDir "packages"
127registry :: PackageCache -> FilePath
128registry (PackageCache dir) =
129 dir </> "registry.dat"
132package :: PackageCache -> Pkg.Name -> V.Version -> FilePath
133package (PackageCache dir) name version =
134 dir </> Pkg.toFilePath name </> V.toChars version
141getReplCache :: IO FilePath
146getCacheDir :: FilePath -> IO FilePath
147getCacheDir projectName =
148 do home <- getElmHome
149 let root = home </> compilerVersion </> projectName
150 Dir.createDirectoryIfMissing True root
154getElmHome :: IO FilePath
156 do maybeCustomHome <- Env.lookupEnv "ELM_HOME"
157 case maybeCustomHome of
158 Just customHome -> return customHome
159 Nothing -> Dir.getAppUserDataDirectory "elm"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list