From a7a3b22dcd64294df80552b55ef1a40cadc92718 Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 11 Oct 2024 06:00:59 +0000 Subject: [PATCH] Fix no such file exception --- .../java/io/xpipe/app/browser/BrowserTransferModel.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java index 5f1818bba..c5a5ba5df 100644 --- a/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java +++ b/app/src/main/java/io/xpipe/app/browser/BrowserTransferModel.java @@ -158,8 +158,7 @@ public class BrowserTransferModel { public void transferToDownloads() throws Exception { List toMove; synchronized (items) { - toMove = - items.stream().filter(item -> item.downloadFinished().get()).toList(); + toMove = items.stream().filter(item -> item.downloadFinished().get()).toList(); if (toMove.isEmpty()) { return; } @@ -170,6 +169,10 @@ public class BrowserTransferModel { var downloads = DesktopHelper.getDownloadsDirectory(); Files.createDirectories(downloads); for (Path file : files) { + if (!Files.exists(file)) { + continue; + } + var target = downloads.resolve(file.getFileName()); // Prevent DirectoryNotEmptyException if (Files.exists(target) && Files.isDirectory(target)) {