{-# LANGUAGE Safe #-}
module Embedder.Config
( module ReWire.Config
, getEmbedFile, getAtmoFile
) where
import ReWire.Config
import Control.Lens ((^.))
import Data.Maybe (fromMaybe)
import System.FilePath ((-<.>))
getEmbedFile :: Config -> FilePath -> FilePath
getEmbedFile :: Config -> FilePath -> FilePath
getEmbedFile Config
c FilePath
filename = (FilePath -> Maybe FilePath -> FilePath)
-> Maybe FilePath -> FilePath -> FilePath
forall a b c. (a -> b -> c) -> b -> a -> c
flip FilePath -> Maybe FilePath -> FilePath
forall a. a -> Maybe a -> a
fromMaybe (Config
cConfig
-> Getting (Maybe FilePath) Config (Maybe FilePath)
-> Maybe FilePath
forall s a. s -> Getting a s a -> a
^.Getting (Maybe FilePath) Config (Maybe FilePath)
Lens' Config (Maybe FilePath)
outFile) (FilePath -> FilePath) -> FilePath -> FilePath
forall a b. (a -> b) -> a -> b
$ FilePath
filename FilePath -> FilePath -> FilePath
-<.> FilePath
"thy"
getAtmoFile :: Config -> FilePath -> FilePath
getAtmoFile :: Config -> FilePath -> FilePath
getAtmoFile Config
c FilePath
filename = (FilePath -> Maybe FilePath -> FilePath)
-> Maybe FilePath -> FilePath -> FilePath
forall a b c. (a -> b -> c) -> b -> a -> c
flip FilePath -> Maybe FilePath -> FilePath
forall a. a -> Maybe a -> a
fromMaybe (Config
cConfig
-> Getting (Maybe FilePath) Config (Maybe FilePath)
-> Maybe FilePath
forall s a. s -> Getting a s a -> a
^.Getting (Maybe FilePath) Config (Maybe FilePath)
Lens' Config (Maybe FilePath)
outFile) (FilePath -> FilePath) -> FilePath -> FilePath
forall a b. (a -> b) -> a -> b
$ FilePath
filename FilePath -> FilePath -> FilePath
-<.> FilePath
"atmo"