Add atomic_folder
#35
Comments
|
Yes, but I want the folder "foo" only to exists if the operation (in the example above |
I guess that makes sense! I am open to PRs |
I actually have a (buggy) version of the |
Sounds fine to me. I guess it's in the spirit of this package to provide a less buggy one. |
afaik there isn't a way to make folder rename atomic
(you would then need to delete / rename which is always going to race with another process) The usual trick is to use symlinks: mkdir -p _targets/dir1 _targets/dir2
touch _targets/dir1/1 _targets/dir2/2
ln -s "$PWD/_targets/dir1" dir
ln -s "$PWD/_targets/dir2" tmpdir
mv tmpdir dir but symlinks require platform support and sometimes the contents of the directories can be sensitive to their actual location vs the symlinked location |
@asottile I think the assumption was to force a value of |
Sometimes I have a bunch of operations which create many files in a folder. The folder should only be there in the end of the operation. Something like this:
The text was updated successfully, but these errors were encountered: