btw. We have lots and lots of filesystem-race conditions. Most often these does not matter much, but we should plan to get rid of them...
fs::exists(foo) && fs::is_directory(foo) is actually racy and can result in an unwanted exeption since foo can have been deleted between the call to exists and the call to is_directory.
I'm sure that you're the man for this |-P
Angus