Fix bug in createDirRecursive with trailing path separators
This commit is contained in:
parent
23f4221fe1
commit
ec9884276c
@ -1,5 +1,9 @@
|
||||
# Revision history for hpath-directory
|
||||
|
||||
## 0.13.2 -- 2020-02-17
|
||||
|
||||
* Fix bug in `createDirRecursive` with trailing path separators
|
||||
|
||||
## 0.13.1 -- 2020-01-29
|
||||
|
||||
* Split some functionality out into 'hpath-posix'
|
||||
|
@ -1,7 +1,7 @@
|
||||
cabal-version: >=1.10
|
||||
|
||||
name: hpath-directory
|
||||
version: 0.13.1
|
||||
version: 0.13.2
|
||||
synopsis: Alternative to 'directory' package with ByteString based filepaths
|
||||
description: This provides a safer alternative to the 'directory'
|
||||
package. FilePaths are ByteString based, so this
|
||||
|
@ -742,8 +742,8 @@ createDirRecursive fm p = go p
|
||||
| en == eEXIST
|
||||
-> unlessM (doesDirectoryExist dest) (ioError e)
|
||||
| en == eNOENT
|
||||
-> createDirRecursive fm (takeDirectory dest)
|
||||
>> createDirectory dest fm
|
||||
-> go (takeDirectory $ dropTrailingPathSeparator dest)
|
||||
>> createDir fm dest
|
||||
| otherwise
|
||||
-> ioError e
|
||||
|
||||
|
@ -49,6 +49,11 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
||||
createDirRecursive' "newDir"
|
||||
deleteDir' "newDir"
|
||||
|
||||
it "createDirRecursive with trailing path separator, all fine" $ do
|
||||
createDirRecursive' "newDir/foo/"
|
||||
deleteDir' "newDir/foo"
|
||||
deleteDir' "newDir"
|
||||
|
||||
it "createDirRecursive, parent directories do not exist" $ do
|
||||
createDirRecursive' "some/thing/dada"
|
||||
deleteDir' "some/thing/dada"
|
||||
|
Loading…
Reference in New Issue
Block a user