File tree Expand file tree Collapse file tree 2 files changed +14
-15
lines changed
hnix-store-core/src/System/Nix Expand file tree Collapse file tree 2 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ module System.Nix.Nar (
1818 , localUnpackNar
1919 , narEffectsIO
2020 , putNar
21+ , FilePathPart (.. )
22+ , filePathPart
2123 ) where
2224
2325import Control.Applicative
@@ -42,7 +44,6 @@ import System.FilePath
4244import System.Posix.Files (createSymbolicLink , fileSize , getFileStatus ,
4345 isDirectory , readSymbolicLink )
4446
45- import System.Nix.Path
4647
4748data NarEffects (m :: * -> * ) = NarEffects {
4849 narReadFile :: FilePath -> m BSL. ByteString
@@ -65,6 +66,17 @@ data NarEffects (m :: * -> *) = NarEffects {
6566data Nar = Nar { narFile :: FileSystemObject }
6667 deriving (Eq , Show )
6768
69+ -- | A valid filename or directory name
70+ newtype FilePathPart = FilePathPart { unFilePathPart :: BSC. ByteString }
71+ deriving (Eq , Ord , Show )
72+
73+ -- | Construct FilePathPart from Text by checking that there
74+ -- are no '/' or '\\NUL' characters
75+ filePathPart :: BSC. ByteString -> Maybe FilePathPart
76+ filePathPart p = case BSC. any (`elem` [' /' , ' \NUL ' ]) p of
77+ False -> Just $ FilePathPart p
78+ True -> Nothing
79+
6880-- | A FileSystemObject (FSO) is an anonymous entity that can be NAR archived
6981data FileSystemObject =
7082 Regular IsExecutable Int64 BSL. ByteString
Original file line number Diff line number Diff line change 66{-# LANGUAGE OverloadedStrings #-}
77{-# LANGUAGE GeneralizedNewtypeDeriving #-}
88module System.Nix.Path
9- ( FilePathPart (.. )
10- , PathHashAlgo
9+ ( PathHashAlgo
1110 , Path (.. )
1211 , pathToText
1312 , PathSet
1413 , SubstitutablePathInfo (.. )
1514 , ValidPathInfo (.. )
1615 , PathName (.. )
17- , filePathPart
1816 , pathName
1917 , Roots
2018 ) where
@@ -111,17 +109,6 @@ data ValidPathInfo = ValidPathInfo
111109 ca :: ! Text
112110 } deriving (Eq , Ord , Show )
113111
114- -- | A valid filename or directory name
115- newtype FilePathPart = FilePathPart { unFilePathPart :: BSC. ByteString }
116- deriving (Eq , Ord , Show )
117-
118- -- | Construct FilePathPart from Text by checking that there
119- -- are no '/' or '\\NUL' characters
120- filePathPart :: BSC. ByteString -> Maybe FilePathPart
121- filePathPart p = case BSC. any (`elem` [' /' , ' \NUL ' ]) p of
122- False -> Just $ FilePathPart p
123- True -> Nothing
124-
125112type Roots = Map Path Path
126113
127114instance Hashable Path where
You can’t perform that action at this time.
0 commit comments