Add equivalent of open(O_CREAT) in GFile
It appears we have no way of opening a file and atomically creating it if it doesn’t already exist, in
GFile — the equivalent of
g_file_create() fails if the file already exists.
g_file_replace() replaces the file.
O_APPEND, so you can’t write to existing offsets in an existing file.
We should look at supporting this: checking whether it’s impossible to do atomically on certain
GFile backends (if so, that might be a reason to not add the API); and checking whether there are any other
open(2) atomic flag combinations which we don’t support.
I realise that there’s always the escape hatch of opening a file using
open() and passing the FD to
g_unix_output_stream_new() — but this is a pretty fundamental atomic operation we’re missing.