From dbec0b8fd77128d8aaa7ec0609bf00a57f52c3fe Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 24 Nov 2023 09:11:23 +0000 Subject: [PATCH] Script order fixes [release] --- .../main/java/io/xpipe/app/browser/OpenFileSystemModel.java | 6 ++++-- core/src/main/java/io/xpipe/core/process/ShellControl.java | 2 -- dist/changelogs/1.7.8.md | 1 + version | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java index 9f5ea4fde..55e8544be 100644 --- a/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java +++ b/app/src/main/java/io/xpipe/app/browser/OpenFileSystemModel.java @@ -40,6 +40,7 @@ public final class OpenFileSystemModel { private final String name; private final String tooltip; private boolean local; + private int customScriptsStartIndex; public OpenFileSystemModel(BrowserModel browserModel, DataStoreEntryRef entry) { this.browserModel = browserModel; @@ -364,6 +365,7 @@ public final class OpenFileSystemModel { BooleanScope.execute(busy, () -> { var fs = entry.getStore().createFileSystem(); if (fs.getShell().isPresent()) { + this.customScriptsStartIndex = fs.getShell().get().getInitCommands().size(); ProcessControlProvider.get().withDefaultScripts(fs.getShell().get()); } fs.open(); @@ -400,7 +402,7 @@ public final class OpenFileSystemModel { var snippet = directory != null ? new SimpleScriptSnippet(connection.getShellDialect().getCdCommand(directory), ScriptSnippet.ExecutionType.BOTH) : null; if (snippet != null) { - connection.withInitSnippet(snippet); + connection.getInitCommands().add(customScriptsStartIndex,snippet); } try { @@ -410,7 +412,7 @@ public final class OpenFileSystemModel { // Restart connection as we will have to start it anyway, so we speed it up by doing it preemptively connection.start(); } finally { - connection.removeInitSnippet(snippet); + connection.getInitCommands().remove(snippet); } } }); diff --git a/core/src/main/java/io/xpipe/core/process/ShellControl.java b/core/src/main/java/io/xpipe/core/process/ShellControl.java index c43fbbf54..3635ec256 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellControl.java @@ -157,8 +157,6 @@ public interface ShellControl extends ProcessControl { ShellControl withInitSnippet(ScriptSnippet snippet); - ShellControl removeInitSnippet(ScriptSnippet snippet); - ShellControl additionalTimeout(int ms); FailableSupplier getElevationPassword(); diff --git a/dist/changelogs/1.7.8.md b/dist/changelogs/1.7.8.md index 14ee47d62..f4499296c 100644 --- a/dist/changelogs/1.7.8.md +++ b/dist/changelogs/1.7.8.md @@ -6,6 +6,7 @@ - More startup performance improvements - Fix dialog window order sometimes being wrong and shown behind main window - Fix macOS Terminal.app sometimes not launching connection due to a race condition +- Many other small miscellaneous fixes and improvements ## Previous changes in 1.7 diff --git a/version b/version index 73c8b4f99..25a6ced8b 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.7.7 \ No newline at end of file +1.7.8 \ No newline at end of file