Fix downloads move not replacing files

This commit is contained in:
crschnick 2024-09-14 20:16:22 +00:00
parent 02153ad23e
commit 7b601b8917

View file

@ -22,6 +22,7 @@ import org.apache.commons.io.FileUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@ -169,7 +170,7 @@ public class BrowserTransferModel {
if (Files.isDirectory(file)) {
FileUtils.moveDirectory(file.toFile(), target.toFile());
} else {
FileUtils.moveFile(file.toFile(), target.toFile());
FileUtils.moveFile(file.toFile(), target.toFile(), StandardCopyOption.REPLACE_EXISTING);
}
}
DesktopHelper.browseFileInDirectory(downloads.resolve(files.getFirst().getFileName()));