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
|
# 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
|
## 0.13.1 -- 2020-01-29
|
||||||
|
|
||||||
* Split some functionality out into 'hpath-posix'
|
* Split some functionality out into 'hpath-posix'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
|
|
||||||
name: hpath-directory
|
name: hpath-directory
|
||||||
version: 0.13.1
|
version: 0.13.2
|
||||||
synopsis: Alternative to 'directory' package with ByteString based filepaths
|
synopsis: Alternative to 'directory' package with ByteString based filepaths
|
||||||
description: This provides a safer alternative to the 'directory'
|
description: This provides a safer alternative to the 'directory'
|
||||||
package. FilePaths are ByteString based, so this
|
package. FilePaths are ByteString based, so this
|
||||||
|
@ -742,8 +742,8 @@ createDirRecursive fm p = go p
|
|||||||
| en == eEXIST
|
| en == eEXIST
|
||||||
-> unlessM (doesDirectoryExist dest) (ioError e)
|
-> unlessM (doesDirectoryExist dest) (ioError e)
|
||||||
| en == eNOENT
|
| en == eNOENT
|
||||||
-> createDirRecursive fm (takeDirectory dest)
|
-> go (takeDirectory $ dropTrailingPathSeparator dest)
|
||||||
>> createDirectory dest fm
|
>> createDir fm dest
|
||||||
| otherwise
|
| otherwise
|
||||||
-> ioError e
|
-> ioError e
|
||||||
|
|
||||||
|
@ -49,6 +49,11 @@ spec = beforeAll_ (upTmpDir >> setupFiles) $ afterAll_ cleanupFiles $
|
|||||||
createDirRecursive' "newDir"
|
createDirRecursive' "newDir"
|
||||||
deleteDir' "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
|
it "createDirRecursive, parent directories do not exist" $ do
|
||||||
createDirRecursive' "some/thing/dada"
|
createDirRecursive' "some/thing/dada"
|
||||||
deleteDir' "some/thing/dada"
|
deleteDir' "some/thing/dada"
|
||||||
|
Loading…
Reference in New Issue
Block a user