mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Fix DirectoryNotEmptyException on downloads move
This commit is contained in:
parent
65f51b8c2e
commit
ebedd332bb
1 changed files with 6 additions and 1 deletions
|
@ -163,7 +163,12 @@ public class BrowserTransferModel {
|
|||
var files = toMove.stream().map(item -> item.getLocalFile()).toList();
|
||||
var downloads = DesktopHelper.getDownloadsDirectory();
|
||||
for (Path file : files) {
|
||||
Files.move(file, downloads.resolve(file.getFileName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
var target = downloads.resolve(file.getFileName());
|
||||
// Prevent DirectoryNotEmptyException
|
||||
if (Files.exists(target) && Files.isDirectory(target)) {
|
||||
Files.delete(target);
|
||||
}
|
||||
Files.move(file, target, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
DesktopHelper.browseFileInDirectory(downloads.resolve(files.getFirst().getFileName()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue