Your comments

I want to point out, as in the original topic, that if the file does not exist, but the write permissions of the directory require root (or admin for windows I suppose) that it just gives an error instead of elevating privileges to write to the directory.