summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorstuebinm2021-11-10 23:26:10 +0100
committerstuebinm2021-11-10 23:28:12 +0100
commit0b29a7e82a8c2dcf9ce4f2fba3ec07896fa72397 (patch)
treee508d14d432595eaf13cea2a7dead9cd7ef28953 /lib
parent1338e4a1c9f445e5384cdee3d65cf5a46ce03105 (diff)
fail on missing map assets
(but not (yet?) on missing maps/entrypoints)
Diffstat (limited to '')
-rw-r--r--lib/WriteRepo.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/WriteRepo.hs b/lib/WriteRepo.hs
index c0bf31b..1ed3a84 100644
--- a/lib/WriteRepo.hs
+++ b/lib/WriteRepo.hs
@@ -16,15 +16,18 @@ import Data.Set (Set)
import qualified Data.Set as S
import Paths (normalise)
import System.Directory.Extra (copyFile, createDirectoryIfMissing)
+import System.Exit (ExitCode (..))
import System.FilePath (takeDirectory)
import qualified System.FilePath as FP
import System.FilePath.Posix ((</>))
import Types (Dep (Local))
-writeAdjustedRepository :: FilePath -> FilePath -> DirResult -> IO ()
+writeAdjustedRepository :: FilePath -> FilePath -> DirResult -> IO ExitCode
writeAdjustedRepository inPath outPath result
- | resultIsFatal result = pure ()
+ | resultIsFatal result = do
+ putStrLn "FATAL: Repository has missing assets; cannot write to outPath"
+ pure (ExitFailure 1)
| otherwise = do
createDirectoryIfMissing True outPath
@@ -41,7 +44,7 @@ writeAdjustedRepository inPath outPath result
let mapdir = takeDirectory mappath in
mapMaybe (\case
Local path -> Just . normalise mapdir $ path
- _ -> Nothing)
+ _ -> Nothing)
$ mapresultDepends mapresult)
. toList $ dirresultMaps result
@@ -53,3 +56,5 @@ writeAdjustedRepository inPath outPath result
in do
putStrLn $ "copying " <> assetPath <> " → " <> newPath
copyFile assetPath newPath
+
+ pure ExitSuccess