Closed lmoelleb closed 4 years ago
@lmoelleb I'm ok to accept your PR as is, however maybe "CreateDirectory" option is not needed at all?.. It is possible to check for directory existense in 'OpenFile' and call 'CreateDirectory' only if directory does not exist, and this update in the behavior seems backward-compatible.
The current behavior is to throw an exception if the directory does not exist. Personally I do not need this behavior, but I would consider defaulting to create the directory a change - this is the reason I added the option defaulting to the old behavior.
So as far as I can see, there are three options:
I am OK with all three options. If it was up to me, I would probably go for the last option :)
Based on your preference, I will make a new pull request - I need to at least sort out the merge conflict as Git isn't smart enough to realize it's just two separate tests added the same place.
For checking the directory exists in OpenFile - it is not needed. CreateDirectory will not fail if the directory exists - it just won't do anything.
- Remove the option and simply let it create the directory. I am OK with all three options. If it was up to me, I would probably go for the last option :)
I also vote for variant (3). It's hard to imagine the situation when directory should NOT be created if not exists (this wasn't implemented only because I forgot to make this check!).
Thank you for the contribution :-)
Ok, option 3) it is. PR updated.
Considered making it a default option, but that would be a change to the default behavior.