From f4f3f21a70a91b99c5b653ef24d6413f60a38829 Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 15 May 2024 09:01:04 +0000 Subject: [PATCH] Synchronize fs close --- .../app/browser/fs/OpenFileSystemModel.java | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java index 4c45c7d98..9761655e8 100644 --- a/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/fs/OpenFileSystemModel.java @@ -100,25 +100,27 @@ public final class OpenFileSystemModel extends BrowserSessionTab { + if (fileSystem == null) { + return; } - } - try { - fileSystem.close(); - } catch (IOException e) { - ErrorEvent.fromThrowable(e).handle(); - } - fileSystem = null; + + if (DataStorage.get().getStoreEntries().contains(getEntry().get()) + && savedState != null + && getCurrentPath().get() != null) { + if (getBrowserModel() instanceof BrowserSessionModel bm) { + bm.getSavedState() + .add(new BrowserSavedState.Entry( + getEntry().get().getUuid(), getCurrentPath().get())); + } + } + try { + fileSystem.close(); + } catch (IOException e) { + ErrorEvent.fromThrowable(e).handle(); + } + fileSystem = null; + }); } private void startIfNeeded() throws Exception {