[Xfce-bugs] [Bug 15727] Replacing a file via Cut and Paste in the same filesystem makes a copy

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Wed Aug 21 19:21:04 CEST 2019


https://bugzilla.xfce.org/show_bug.cgi?id=15727

--- Comment #10 from Reuben Green <reubengreen73 at gmail.com> ---
Yes, you're right, the fallback code can be reached after the user has chosen
to overwrite, leading to the thunar_job_ask_replace dialog appearing twice. To
trigger this, you can copy one file onto another file with the same name on a
different filesystem. Well spotted, my bad!

Yes, I agree that it would be best to use only invoke the fallback when it
makes sense, and I think G_IO_WOULD_RECURSE and _WOULD_MERGE would indeed be
such cases.

One case we certainly will need the fallback code is when g_file_move cannot
perform a native move, for example when replacing a file with another file from
a different filesystem. The simplest way I can think of to ensure that the user
does not get asked twice about replacing the same file would be to add a member
"replace_confirmed" to the ThunarTransferNode struct to indicate that the user
has already said to replace the file and modifying
thunar_transfer_job_copy_file to take an extra "don't ask for confirmation"
parameter.

Another thought that occurs to me is to wonder what exactly the thunar
copy+delete code has that we can't get from just using the g_file_move internal
copy+delete fallback, since using that would simplify the code a lot. After a
*very* quick read of the code, it seems that the only extra thing the thunar
code does is ask the user if they want to retry deleting the source file if
this fails (although I could very easily have missed something else!). If that
is all, them perhaps one could simply use the g_file_move copy+delete and just
check in a loop if the source file is still there and ask if the user wants to
remove it?

Hmm, this might be more complicated than I thought. I will go and have a
careful read through the code when I have a moment and see what I can come up
with.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Xfce-bugs mailing list