Merge pull request #786 from joelteon/master
Strip src/ prefix in yesod devel
This commit is contained in:
commit
bc6e0293ae
@ -33,7 +33,8 @@ import qualified Data.Set as Set
|
|||||||
|
|
||||||
import qualified System.Posix.Types
|
import qualified System.Posix.Types
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import System.FilePath (takeExtension, replaceExtension, (</>), takeDirectory)
|
import System.FilePath (takeExtension, replaceExtension, (</>), takeDirectory,
|
||||||
|
splitPath, joinPath)
|
||||||
import System.PosixCompat.Files (getFileStatus, setFileTimes,
|
import System.PosixCompat.Files (getFileStatus, setFileTimes,
|
||||||
accessTime, modificationTime)
|
accessTime, modificationTime)
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ removeHi :: FilePath -> FilePath -> IO ()
|
|||||||
removeHi _ hs = mapM_ removeFile' hiFiles
|
removeHi _ hs = mapM_ removeFile' hiFiles
|
||||||
where
|
where
|
||||||
removeFile' file = try' (removeFile file) >> return ()
|
removeFile' file = try' (removeFile file) >> return ()
|
||||||
hiFiles = map (\e -> "dist/build" </> replaceExtension hs e)
|
hiFiles = map (\e -> "dist/build" </> removeSrc (replaceExtension hs e))
|
||||||
["hi", "p_hi"]
|
["hi", "p_hi"]
|
||||||
|
|
||||||
-- | change file mtime of .hs file to that of the dependency
|
-- | change file mtime of .hs file to that of the dependency
|
||||||
@ -124,7 +125,12 @@ updateFileTime x hs = do
|
|||||||
return ()
|
return ()
|
||||||
|
|
||||||
hiFile :: FilePath -> FilePath
|
hiFile :: FilePath -> FilePath
|
||||||
hiFile hs = "dist/build" </> replaceExtension hs "hi"
|
hiFile hs = "dist/build" </> removeSrc (replaceExtension hs "hi")
|
||||||
|
|
||||||
|
removeSrc :: FilePath -> FilePath
|
||||||
|
removeSrc f = case splitPath f of
|
||||||
|
("src/" : xs) -> joinPath xs
|
||||||
|
_ -> f
|
||||||
|
|
||||||
try' :: IO x -> IO (Either SomeException x)
|
try' :: IO x -> IO (Either SomeException x)
|
||||||
try' = try
|
try' = try
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user