replace_contents


Description:

public bool replace_contents (uint8[] contents, string? etag, bool make_backup, FileCreateFlags flags, out string new_etag, Cancellable? cancellable = null) throws Error

Replaces the contents of this with contents of contents.length bytes.

If etag is specified (not null), any existing file must have that etag, or the error g_io_error_wrong_etag will be returned.

If make_backup is true, this function will attempt to make a backup of this.

If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error g_io_error_cancelled will be returned.

The returned new_etag can be used to verify that the file hasn't changed the next time it is saved over.

Parameters:

this

input File

contents

a string containing the new contents for this

etag

the old entity-tag for the document, or null

make_backup

true if a backup should be created

flags

a set of FileCreateFlags

new_etag

a location to a new entity tag for the document. This should be freed with g_free when no longer needed, or null

cancellable

optional Cancellable object, null to ignore

length

the length of contents in bytes

Returns:

true if successful. If an error has occurred, this function will return false and set throws appropriately if present.