I have some file/directory managment tool based on TxF system. Basically it's working like this:
CreateTransaction
function.CreateDirectoryTransacted
function.CommitTransaction
called so far).Is there some substitute to PathFileExists
but working with transaction system?
I've managed to resolve this problem using CreateDirectoryTransacted
and error code ERROR_ALREADY_EXISTS
.
Here is how:
CreateDirectoryTransacted
returns different error codes, one of them is ERROR_ALREADY_EXISTS
. I can use this specific error to determine if directory already exists. If it does not, and I just created it there is nothing to worry about - I can safely remove it in the same transaction using RemoveDirectoryTransacted
. I'm aware there will be some minor overhead if a lot of create->remove directory happen, but it's just not my case. It's just how I get around this problem.
If somebody have idea for a better solution - I'm open to change correct answear to some more general solution.