GNOME Bugzilla – Bug 540656
Cannot overwriting existing files using Gio::File::replace
Last modified: 2008-07-02 16:47:17 UTC
giomm passes an empty string instead of NULL as the etag parameter to g_file_replace or g_file_replace_async, respectively. g_file_replace does only overwrite files if the given etag matches the one of the existing file, except when the given etag is NULL. Since giomm does not allow passing NULL to the C function, it is quite troublesome to overwrite a file using that function. I propose passing NULL to the C function if the etag parameter is the empty string ("").
Created attachment 113577 [details] [review] Proposed patch This patch passes NULL to the C function if the etag parameter is the empty string.
Looks good. Please commit.
Committed to trunk and glibmm-2-16.
I guess that the use of g_file_replace_contents() needs this too, though I have not investigated whether "" has any meaning in any of these functions. Could you fix that too, if necessary, please. And please mention this bug number in the ChangeLog.
2008-07-02 Armin Burgmeier <armin@arbur.net> * gio/src/file.ccg: Pass NULL to the underlying C function for the etags parameter in the various replace_contents functions. Also bug #540656. Again, committed to trunk and glibmm-2-16