hashed-storage 0.4.10 → 0.4.11
raw patch · 3 files changed
+14/−11 lines, 3 filesnew-uploaderPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Bundled/Posix.hsc +6/−3
- Storage/Hashed/Plain.hs +7/−7
- hashed-storage.cabal +1/−1
Bundled/Posix.hsc view
@@ -4,7 +4,7 @@ , getFileStatusBS , fileExists , modificationTime, fileSize, FileStatus- , EpochTime, isDirectory ) where+ , EpochTime, isDirectory, isRegularFile ) where import qualified Data.ByteString.Char8 as BS import Data.ByteString.Unsafe( unsafeUseAsCString )@@ -16,7 +16,7 @@ import System.Posix.Internals ( CStat, c_fstat, lstat, c_stat, sizeof_stat- , st_mode, st_size, st_mtime, s_isdir )+ , st_mode, st_size, st_mtime, s_isdir, s_isreg ) import System.Posix.Types ( Fd(..), CMode, EpochTime ) @@ -58,6 +58,9 @@ isDirectory :: FileStatus -> Bool isDirectory = s_isdir . fst_mode +isRegularFile :: FileStatus -> Bool+isRegularFile = s_isreg . fst_mode+ modificationTime :: FileStatus -> EpochTime modificationTime = fst_mtime @@ -80,7 +83,7 @@ getFileStatus :: FilePath -> IO FileStatus getFileStatus fp =- do_stat (\p -> (fp `withCString` (`c_stat` p)))+ do_stat (\p -> (fp `withCString` (`lstat` p))) -- | Requires NULL-terminated bytestring -> unsafe! Use with care. getFileStatusBS :: BS.ByteString -> IO FileStatus
Storage/Hashed/Plain.hs view
@@ -13,13 +13,14 @@ plainTreeIO -- (obsolete? if so remove implementation!) ) where +import Data.Maybe( catMaybes ) import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BS8 import qualified Data.ByteString.Lazy as BL import System.FilePath( (</>) ) import System.Directory( getDirectoryContents , createDirectoryIfMissing )-import Bundled.Posix( getFileStatus, isDirectory, FileStatus )+import Bundled.Posix( getFileStatus, isDirectory, isRegularFile, FileStatus ) import Control.Monad( forM_ ) import Storage.Hashed.AnchoredPath@@ -43,13 +44,12 @@ readPlainTree :: FilePath -> IO (Tree IO) readPlainTree dir = do items <- readPlainDir dir- let subs = [+ let subs = catMaybes [ let name = Name (BS8.pack name')- in if isDirectory status- then (name,- Stub (readPlainTree (dir </> name')) NoHash)- else (name, File $- Blob (readBlob' name) NoHash)+ in case status of+ _ | isDirectory status -> Just (name, Stub (readPlainTree (dir </> name')) NoHash)+ _ | isRegularFile status -> Just (name, File $ Blob (readBlob' name) NoHash)+ _ -> Nothing | (name', status) <- items ] return $ makeTree subs where readBlob' (Name name) = readSegment (dir </> BS8.unpack name, Nothing)
hashed-storage.cabal view
@@ -1,5 +1,5 @@ name: hashed-storage-version: 0.4.10+version: 0.4.11 synopsis: Hashed file storage support code. description: Support code for reading and manipulating hashed file storage