Skip to content

Commit

Permalink
remove checkTimestamps from Main
Browse files Browse the repository at this point in the history
  • Loading branch information
mrd committed Aug 29, 2019
1 parent f320e6e commit 436dad6
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -213,25 +213,6 @@ expandDirs = fmap concat . mapM each
then listFortranFiles path
else pure [path]

data TimestampStatus = NoSuchFile | CompileFile | ModFileExists FilePath

-- | Compare the source file timestamp to the fsmod file timestamp, if
-- it exists.
checkTimestamps :: FilePath -> IO TimestampStatus
checkTimestamps path = do
pathExists <- doesFileExist path
modExists <- doesFileExist $ path -<.> modFileSuffix
case (pathExists, modExists) of
(False, _) -> pure NoSuchFile
(True, False) -> pure CompileFile
(True, True) -> do
let modPath = path -<.> modFileSuffix
pathModTime <- getModificationTime path
modModTime <- getModificationTime modPath
if pathModTime < modModTime
then pure $ ModFileExists modPath
else pure CompileFile

-- | Get a list of Fortran files under the given directory.
listFortranFiles :: FilePath -> IO [FilePath]
listFortranFiles dir = filter isFortran <$> listDirectoryRecursively dir
Expand Down

0 comments on commit 436dad6

Please sign in to comment.