summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Daluja <30343-sachindaluja@users.noreply.gitlab.gnome.org>2020-12-05 13:30:36 -0500
committerAntónio Fernandes <antoniof@gnome.org>2021-01-17 17:42:29 +0000
commit33debe4f247fae4afaec14a95ab92119aad3c697 (patch)
tree1fdd769049aaba553869d9f18adf9a571d85defe
parent95767f84807c2b312ace69b8e19adc74a1156722 (diff)
downloadnautilus-33debe4f247fae4afaec14a95ab92119aad3c697.tar.gz
file-operations: Fix directory "skipped" flag
During a "merge" directory copy operation, when recursively merging a directory to a destination directory that already contains some files or subdirectories that are being copied, the "skip" flag is set individually for those files or subdirectories. This correctly reduces the count total files being copied for each file or subdirectory that was skipped. However, the "skipped" flag was then also being set for the parent directory even though that directory was successfully copied (when represented as a single file which is also included in the file count). This ended up incorrectly reducing the total file count even though the copied file count was incremented for that directory. Change code to ensure that the "skipped" flag is not set for a directory when one or more children are skipped.
-rw-r--r--src/nautilus-file-operations.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index c007f7625..3bd7d55aa 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -4776,6 +4776,7 @@ copy_move_directory (CopyMoveJob *copy_job,
GFileCopyFlags flags;
job = (CommonJob *) copy_job;
+ *skipped_file = FALSE;
if (create_dest)
{
@@ -4979,7 +4980,7 @@ retry:
else if (response == 1)
{
/* Skip: Do Nothing */
- local_skipped_file = TRUE;
+ *skipped_file = TRUE;
}
else if (response == 2)
{
@@ -5003,6 +5004,7 @@ retry:
if (!job_aborted (job) && copy_job->is_move &&
/* Don't delete source if there was a skipped file */
+ !*skipped_file &&
!local_skipped_file)
{
if (!g_file_delete (src, job->cancellable, &error))
@@ -5011,7 +5013,7 @@ retry:
if (job->skip_all_error)
{
- local_skipped_file = TRUE;
+ *skipped_file = TRUE;
goto skip;
}
basename = get_basename (src);
@@ -5033,11 +5035,11 @@ retry:
else if (response == 1) /* skip all */
{
job->skip_all_error = TRUE;
- local_skipped_file = TRUE;
+ *skipped_file = TRUE;
}
else if (response == 2) /* skip */
{
- local_skipped_file = TRUE;
+ *skipped_file = TRUE;
}
else
{
@@ -5049,11 +5051,6 @@ skip:
}
}
- if (local_skipped_file)
- {
- *skipped_file = TRUE;
- }
-
g_free (dest_fs_type);
return TRUE;
}