optimise logfile to key parsing
Using bytestring-filepath
This commit is contained in:
parent
9468675ba9
commit
98e2e3cb9c
1 changed files with 3 additions and 3 deletions
6
Logs.hs
6
Logs.hs
|
@ -205,11 +205,11 @@ isRemoteContentIdentifierLog path = remoteContentIdentifierExt `S.isSuffixOf` pa
|
||||||
{- From an extension and a log filename, get the key that it's a log for. -}
|
{- From an extension and a log filename, get the key that it's a log for. -}
|
||||||
extLogFileKey :: S.ByteString -> RawFilePath -> Maybe Key
|
extLogFileKey :: S.ByteString -> RawFilePath -> Maybe Key
|
||||||
extLogFileKey expectedext path
|
extLogFileKey expectedext path
|
||||||
| encodeBS' ext == expectedext = fileKey (toRawFilePath base)
|
| ext == expectedext = fileKey base
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
where
|
where
|
||||||
file = takeFileName (fromRawFilePath path)
|
file = P.takeFileName path
|
||||||
(base, ext) = splitAt (length file - extlen) file
|
(base, ext) = S.splitAt (S.length file - extlen) file
|
||||||
extlen = S.length expectedext
|
extlen = S.length expectedext
|
||||||
|
|
||||||
{- Converts a url log file into a key.
|
{- Converts a url log file into a key.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue