summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2020-02-21 09:34:59 -0400
committerJoey Hess <joeyh@joeyh.name>2020-02-21 10:04:44 -0400
commitc31e1be781b66647a749dea66d32de57b0ce4e9f (patch)
tree7901a60b6f9bb5c5bece1f2b7848b3348a8dcd85 /Backend
parente468fbc518fa75dcbd3584632e1799a2746a911b (diff)
convert KeySource to RawFilePath
Diffstat (limited to 'Backend')
-rw-r--r--Backend/Hash.hs4
-rw-r--r--Backend/WORM.hs7
2 files changed, 6 insertions, 5 deletions
diff --git a/Backend/Hash.hs b/Backend/Hash.hs
index e8fea3c035..1da11240af 100644
--- a/Backend/Hash.hs
+++ b/Backend/Hash.hs
@@ -90,7 +90,7 @@ hashKeyVariety (Blake2spHash size) he = Blake2spKey size he
{- A key is a hash of its contents. -}
keyValue :: Hash -> KeySource -> MeterUpdate -> Annex (Maybe Key)
keyValue hash source meterupdate = do
- let file = contentLocation source
+ let file = fromRawFilePath (contentLocation source)
filesize <- liftIO $ getFileSize file
s <- hashFile hash file meterupdate
return $ Just $ mkKey $ \k -> k
@@ -106,7 +106,7 @@ keyValueE hash source meterupdate =
where
addE k = do
maxlen <- annexMaxExtensionLength <$> Annex.getGitConfig
- let ext = selectExtension maxlen (toRawFilePath (keyFilename source))
+ let ext = selectExtension maxlen (keyFilename source)
return $ Just $ alterKey k $ \d -> d
{ keyName = keyName d <> ext
, keyVariety = hashKeyVariety hash (HasExt True)
diff --git a/Backend/WORM.hs b/Backend/WORM.hs
index 35fa858b88..e141e1c132 100644
--- a/Backend/WORM.hs
+++ b/Backend/WORM.hs
@@ -16,6 +16,7 @@ import Git.FilePath
import Utility.Metered
import qualified Data.ByteString.Char8 as S8
+import qualified Utility.RawFilePath as R
backends :: [Backend]
backends = [backend]
@@ -36,10 +37,10 @@ backend = Backend
keyValue :: KeySource -> MeterUpdate -> Annex (Maybe Key)
keyValue source _ = do
let f = contentLocation source
- stat <- liftIO $ getFileStatus f
- sz <- liftIO $ getFileSize' f stat
+ stat <- liftIO $ R.getFileStatus f
+ sz <- liftIO $ getFileSize' (fromRawFilePath f) stat
relf <- fromRawFilePath . getTopFilePath
- <$> inRepo (toTopFilePath $ toRawFilePath $ keyFilename source)
+ <$> inRepo (toTopFilePath $ keyFilename source)
return $ Just $ mkKey $ \k -> k
{ keyName = genKeyName relf
, keyVariety = WORMKey