Add takeAllParents

Bu işleme şunda yer alıyor:
Julian Ospald 2020-01-26 20:00:46 +01:00
ebeveyn 7d0ca1c230
işleme b7cd5ba857
Veri tabanında bu imza için bilinen anahtar bulunamadı
GPG Anahtar Kimliği: 511B62C09D50CD28
1 değiştirilmiş dosya ile 16 ekleme ve 0 silme

Dosyayı Görüntüle

@ -59,6 +59,7 @@ module System.Posix.FilePath (
, splitPath
, joinPath
, splitDirectories
, takeAllParents
-- * Trailing slash functions
, hasTrailingPathSeparator
@ -500,6 +501,21 @@ splitDirectories x
splitter = filter (not . BS.null) . BS.split pathSeparator
-- |Get all parents of a path.
--
-- >>> takeAllParents "/abs/def/dod"
-- ["/abs/def","/abs","/"]
-- >>> takeAllParents "/foo"
-- ["/"]
-- >>> takeAllParents "/"
-- []
takeAllParents :: RawFilePath -> [RawFilePath]
takeAllParents p
| np == BS.singleton pathSeparator = []
| otherwise = takeDirectory np : takeAllParents (takeDirectory np)
where
np = normalise p
------------------------
-- Trailing slash functions