1 module Databrary.Store.Stage 2 ( stageFile 3 ) where 4 5 import Databrary.Ops 6 import Databrary.Files 7 import Databrary.Store.Types 8 9 import System.Posix.Files.ByteString (fileExist) 10 11 stageFile :: RawFilePath -> Storage -> IO (Maybe RawFilePath) 12 stageFile f Storage{ storageStage = Just s } = 13 (sf `useWhen`) <$> fileExist sf where sf = s </> f 14 stageFile _ _ = return Nothing