summaryrefslogtreecommitdiff
path: root/src/Codec/Archive/Pack/Common.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Codec/Archive/Pack/Common.hs')
-rw-r--r--src/Codec/Archive/Pack/Common.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Codec/Archive/Pack/Common.hs b/src/Codec/Archive/Pack/Common.hs
index fb0ec12..aa36e5c 100644
--- a/src/Codec/Archive/Pack/Common.hs
+++ b/src/Codec/Archive/Pack/Common.hs
@@ -5,17 +5,18 @@ import qualified Data.ByteString as BS
import System.PosixCompat.Files (fileGroup, fileMode, fileOwner,
getFileStatus, isDirectory,
isRegularFile, isSymbolicLink,
- readSymbolicLink)
+ linkCount, readSymbolicLink)
mkContent :: FilePath -> IO EntryContent
mkContent fp = do
status <- getFileStatus fp
- let res = (isRegularFile status, isDirectory status, isSymbolicLink status)
+ let res = (isRegularFile status, isDirectory status, isSymbolicLink status, linkCount status)
case res of
- (True, False, False) -> NormalFile <$> BS.readFile fp
- (False, True, False) -> pure Directory
- (False, False, True) -> Symlink <$> readSymbolicLink fp
- (_, _, _) -> error "inconsistent read result"
+ (True, False, False, 1) -> NormalFile <$> BS.readFile fp
+ (True, False, False, _) -> pure $ Hardlink fp
+ (False, True, False, _) -> pure Directory
+ (False, False, True, _) -> Symlink <$> readSymbolicLink fp
+ (_, _, _, _) -> error "inconsistent read result"
mkEntry :: FilePath -> IO Entry
mkEntry fp = do