Whenever a file that is being written to is located in a sub directory withBinaryFileDurableAtomic results in a runtime exception during the atomic rename.
Same problem applies to writeBinaryFileDurableAtomic.
Here is a short repro:
import Import
import RIO.Directory
import RIO.File
run :: RIO App ()
run = do
logInfo "We're inside the application!"
let foo = "foo.txt"
withBinaryFileDurableAtomic foo WriteMode $ \h -> do
hPutBuilder h "foo"
logInfo $ "Written " <> fromString foo
let barFoo = "bar/foo.txt"
createDirectoryIfMissing True barFoo
withBinaryFileDurableAtomic barFoo WriteMode $ \h -> do
hPutBuilder h "bar - foo"
logInfo $ "Written " <> fromString barFoo
Which results in:
$ stack run
We're inside the application!
Written foo.txt
atomic-durable-exe: closeFileDurableAtomic - renameFile: does not exist (No such file or directory)
Whenever a file that is being written to is located in a sub directory
withBinaryFileDurableAtomic
results in a runtime exception during the atomic rename.Same problem applies to
writeBinaryFileDurableAtomic
.Here is a short repro:
Which results in: