mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-05 16:04:31 +00:00
file-operations: Simplify output files handling when extracting
Currently, output files are checked for existence. But the files are explicitely deleted in the case of extraction failure, so this extra check is no more needed. Let's drop the redundant check and just update the list when deleting the files.
This commit is contained in:
parent
d09b34cde2
commit
bdd317d999
1 changed files with 6 additions and 19 deletions
|
@ -8330,6 +8330,7 @@ extract_job_on_error (AutoarExtractor *extractor,
|
|||
{
|
||||
ExtractJob *extract_job = user_data;
|
||||
GFile *source_file;
|
||||
GFile *destination;
|
||||
gint response_id;
|
||||
g_autofree gchar *basename = NULL;
|
||||
|
||||
|
@ -8349,7 +8350,11 @@ extract_job_on_error (AutoarExtractor *extractor,
|
|||
*/
|
||||
if (extract_job->destination_decided)
|
||||
{
|
||||
delete_file_recursively (extract_job->output_files->data, NULL, NULL, NULL);
|
||||
destination = extract_job->output_files->data;
|
||||
delete_file_recursively (destination, NULL, NULL, NULL);
|
||||
extract_job->output_files = g_list_delete_link (extract_job->output_files,
|
||||
extract_job->output_files);
|
||||
g_object_unref (destination);
|
||||
}
|
||||
|
||||
basename = get_basename (source_file);
|
||||
|
@ -8602,7 +8607,6 @@ extract_task_thread_func (GTask *task,
|
|||
{
|
||||
ExtractJob *extract_job = task_data;
|
||||
GList *l;
|
||||
GList *existing_output_files = NULL;
|
||||
gint total_files;
|
||||
g_autofree guint64 *archive_compressed_sizes = NULL;
|
||||
gint i;
|
||||
|
@ -8690,23 +8694,6 @@ extract_task_thread_func (GTask *task,
|
|||
report_extract_final_progress (extract_job, total_files);
|
||||
}
|
||||
|
||||
for (l = extract_job->output_files; l != NULL; l = l->next)
|
||||
{
|
||||
GFile *output_file;
|
||||
|
||||
output_file = G_FILE (l->data);
|
||||
|
||||
if (g_file_query_exists (output_file, NULL))
|
||||
{
|
||||
existing_output_files = g_list_prepend (existing_output_files,
|
||||
g_object_ref (output_file));
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free_full (extract_job->output_files, g_object_unref);
|
||||
|
||||
extract_job->output_files = existing_output_files;
|
||||
|
||||
if (extract_job->common.undo_info)
|
||||
{
|
||||
if (extract_job->output_files)
|
||||
|
|
Loading…
Reference in a new issue