BuilderSourceFile: Delete destination file

Sometimes you want to replace an existing file, like a config.sub,
and sometimes that existing config.sub does not have the writable
bits set. Just delete the file if we intend to replace it anyway.
This commit is contained in:
Tristan Van Berkom
2016-04-27 00:32:31 +01:00
committed by Alexander Larsson
parent f37b3261d6
commit bc7bfeef6f

View File

@@ -366,6 +366,12 @@ builder_source_file_extract (BuilderSource *source,
dest_file = g_file_get_child (dest, dest_filename);
/* If the destination file exists, just delete it. We can encounter errors when
* trying to overwrite files that are not writable.
*/
if (g_file_query_exists (dest_file, NULL) && !g_file_delete (dest_file, NULL, error))
return FALSE;
if (is_inline)
{
g_autoptr(GBytes) content = NULL;