Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- getTrashPathDir :: PathI TrashHome -> PathI TrashDirFiles
- getTrashInfoDir :: PathI TrashHome -> PathI TrashDirInfo
- getTrashPath :: PathI TrashHome -> PathI TrashEntryFileName -> PathI TrashEntryPath
- pathFiles :: OsPath
- pathInfo :: OsPath
- getPathInfo :: (HasCallStack, MonadCatch m, MonadLoggerNS m, MonadPathReader m) => PathI TrashHome -> PathI TrashEntryOriginalPath -> m (PathI TrashEntryFileName, PathI TrashEntryOriginalPath, PathTypeW)
- parseTrashInfoMap :: HashSet ByteString -> ByteString -> Either String (HashMap ByteString ByteString)
- pathDataToType :: (Is k A_Getter, LabelOptic' "fileName" k a (PathI TrashEntryFileName), HasCallStack, MonadCatch m, MonadPathReader m) => PathI TrashHome -> a -> m PathTypeW
- lookup :: ByteString -> HashMap ByteString b -> Either String b
Trash paths
getTrashPathDir :: PathI TrashHome -> PathI TrashDirFiles Source #
Retrieves the trash path dir.
getTrashInfoDir :: PathI TrashHome -> PathI TrashDirInfo Source #
Retrieves the trash info dir.
Paths
Misc
getPathInfo :: (HasCallStack, MonadCatch m, MonadLoggerNS m, MonadPathReader m) => PathI TrashHome -> PathI TrashEntryOriginalPath -> m (PathI TrashEntryFileName, PathI TrashEntryOriginalPath, PathTypeW) Source #
For a given path, retrieves its unique trash entry file name, original path, and type.
NOTE: This function is almost backend agnostic. AFAICT the only part that uses internal knowledge is the call to getTrashPath. If we ever write a non-default backend then we should extract that logic to a function and move this fn to Utils, as the rest of the logic is something we will want to use everywhere (e.g. throwIfIllegal).
:: HashSet ByteString | Expected keys |
-> ByteString | ByteString |
-> Either String (HashMap ByteString ByteString) |
Parses a ByteString like:
[Trash Info] k1=v1 k2=v2 ...
into a map of { ki => vi }
.
Verifies that the parameter key set is exactly the key set in the map.
pathDataToType :: (Is k A_Getter, LabelOptic' "fileName" k a (PathI TrashEntryFileName), HasCallStack, MonadCatch m, MonadPathReader m) => PathI TrashHome -> a -> m PathTypeW Source #
Derives the PathType
from the PathData
.
IMPORTANT: This function is only guaranteed to work if the PathData
corresponds to an extant trash entry. In particular, if the PathData
has
not been created yet, this can fail.
lookup :: ByteString -> HashMap ByteString b -> Either String b Source #