mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2025-01-05 19:00:24 +03:00
Move FilePathPart from Path.hs to Nar.hs.
This has nothing to do with store paths...
This commit is contained in:
parent
03d9a212e8
commit
aabde18a4a
@ -18,6 +18,8 @@ module System.Nix.Nar (
|
||||
, localUnpackNar
|
||||
, narEffectsIO
|
||||
, putNar
|
||||
, FilePathPart(..)
|
||||
, filePathPart
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
@ -42,7 +44,6 @@ import System.FilePath
|
||||
import System.Posix.Files (createSymbolicLink, fileSize, getFileStatus,
|
||||
isDirectory, readSymbolicLink)
|
||||
|
||||
import System.Nix.Path
|
||||
|
||||
data NarEffects (m :: * -> *) = NarEffects {
|
||||
narReadFile :: FilePath -> m BSL.ByteString
|
||||
@ -65,6 +66,17 @@ data NarEffects (m :: * -> *) = NarEffects {
|
||||
data Nar = Nar { narFile :: FileSystemObject }
|
||||
deriving (Eq, Show)
|
||||
|
||||
-- | A valid filename or directory name
|
||||
newtype FilePathPart = FilePathPart { unFilePathPart :: BSC.ByteString }
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
-- | Construct FilePathPart from Text by checking that there
|
||||
-- are no '/' or '\\NUL' characters
|
||||
filePathPart :: BSC.ByteString -> Maybe FilePathPart
|
||||
filePathPart p = case BSC.any (`elem` ['/', '\NUL']) p of
|
||||
False -> Just $ FilePathPart p
|
||||
True -> Nothing
|
||||
|
||||
-- | A FileSystemObject (FSO) is an anonymous entity that can be NAR archived
|
||||
data FileSystemObject =
|
||||
Regular IsExecutable Int64 BSL.ByteString
|
||||
|
@ -6,15 +6,13 @@ Maintainer : Shea Levy <shea@shealevy.com>
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||
module System.Nix.Path
|
||||
( FilePathPart(..)
|
||||
, PathHashAlgo
|
||||
( PathHashAlgo
|
||||
, Path(..)
|
||||
, pathToText
|
||||
, PathSet
|
||||
, SubstitutablePathInfo(..)
|
||||
, ValidPathInfo(..)
|
||||
, PathName(..)
|
||||
, filePathPart
|
||||
, pathName
|
||||
, Roots
|
||||
) where
|
||||
@ -111,17 +109,6 @@ data ValidPathInfo = ValidPathInfo
|
||||
ca :: !Text
|
||||
} deriving (Eq, Ord, Show)
|
||||
|
||||
-- | A valid filename or directory name
|
||||
newtype FilePathPart = FilePathPart { unFilePathPart :: BSC.ByteString }
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
-- | Construct FilePathPart from Text by checking that there
|
||||
-- are no '/' or '\\NUL' characters
|
||||
filePathPart :: BSC.ByteString -> Maybe FilePathPart
|
||||
filePathPart p = case BSC.any (`elem` ['/', '\NUL']) p of
|
||||
False -> Just $ FilePathPart p
|
||||
True -> Nothing
|
||||
|
||||
type Roots = Map Path Path
|
||||
|
||||
instance Hashable Path where
|
||||
|
Loading…
Reference in New Issue
Block a user