1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

FileOperation: Deduplicate destination file names on copy

When there is a file with the same name in the destination directory,
FileManager overwrites that file without any warning. With this change,
such a file will be automatically renamed to "emoji-2.txt", for example.

Also, currently there is a check in FileManager that makes copy and
paste of a file in the same directory no-op. This change removes that
check, because it is no longer a problem.
This commit is contained in:
Tetsui Ohkubo 2021-08-23 00:32:59 +09:00 committed by Ali Mohammad Pur
parent 09087b8f8e
commit eb326db028
2 changed files with 40 additions and 6 deletions

View file

@ -174,11 +174,6 @@ void do_paste(String const& target_directory, GUI::Window* window)
dbgln("Cannot paste URI {}", uri_as_string);
continue;
}
auto new_path = String::formatted("{}/{}", target_directory, url.basename());
if (url.path() == new_path)
continue;
source_paths.append(url.path());
}