1
1
Fork 0

Add isSpecialDirectoryEntry

Dieser Commit ist enthalten in:
Julian Ospald 2020-01-18 18:43:55 +01:00
Ursprung 1f4e289903
Commit 22ddeeadcc
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 511B62C09D50CD28
1 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -73,6 +73,7 @@ module System.Posix.FilePath (
, isAbsolute
, isValid
, makeValid
, isSpecialDirectoryEntry
, isFileName
, hasParentDir
, hiddenFile
@ -724,6 +725,21 @@ makeValid path
| otherwise = BS.map (\x -> if x == _nul then _underscore else x) path
-- | Is a FilePath valid, i.e. could you create a file like it?
--
-- >>> isSpecialDirectoryEntry "."
-- True
-- >>> isSpecialDirectoryEntry ".."
-- True
-- >>> isSpecialDirectoryEntry "/random_ path:*"
-- False
isSpecialDirectoryEntry :: RawFilePath -> Bool
isSpecialDirectoryEntry filepath
| BS.pack [_period, _period] == filepath = True
| BS.pack [_period] == filepath = True
| otherwise = False
-- | Is the given path a valid filename? This includes
-- "." and "..".
--