From 99d867965b62dc44cd90702e4acb130ac94354d2 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 6 Oct 2024 23:38:50 +0000 Subject: [PATCH] Various small fixes --- .../java/io/xpipe/app/browser/action/BrowserAction.java | 3 +-- app/src/main/java/io/xpipe/app/core/AppLayoutModel.java | 4 ++++ .../main/java/io/xpipe/app/launcher/LauncherCommand.java | 4 +++- app/src/main/java/io/xpipe/app/storage/DataNames.java | 8 -------- app/src/main/java/io/xpipe/app/util/TerminalLauncher.java | 5 ++--- .../ext/base/browser/compress/BaseCompressAction.java | 2 +- .../xpipe/ext/base/browser/compress/BaseUntarAction.java | 2 +- 7 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 app/src/main/java/io/xpipe/app/storage/DataNames.java diff --git a/app/src/main/java/io/xpipe/app/browser/action/BrowserAction.java b/app/src/main/java/io/xpipe/app/browser/action/BrowserAction.java index 839283793..3a89f09f6 100644 --- a/app/src/main/java/io/xpipe/app/browser/action/BrowserAction.java +++ b/app/src/main/java/io/xpipe/app/browser/action/BrowserAction.java @@ -46,8 +46,7 @@ public interface BrowserAction { default List resolveFilesIfNeeded(List selected) { return automaticallyResolveLinks() ? selected.stream() - .map(browserEntry -> - new BrowserEntry(browserEntry.getRawFileEntry().resolved(), browserEntry.getModel())) + .map(browserEntry -> new BrowserEntry(browserEntry.getRawFileEntry().resolved(), browserEntry.getModel())) .toList() : selected; } diff --git a/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java b/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java index db8d52c1f..d6b86b557 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java +++ b/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java @@ -54,6 +54,10 @@ public class AppLayoutModel { } public static void reset() { + if (INSTANCE == null) { + return; + } + AppCache.update("layoutState", INSTANCE.savedState); INSTANCE = null; } diff --git a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java index 3dff94e2e..f0c48277c 100644 --- a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java +++ b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java @@ -74,7 +74,9 @@ public class LauncherCommand implements Callable { cmd.parseArgs(args); cmd.execute(args); } catch (Throwable t) { - var e = ErrorEvent.fromThrowable(t).term().build(); + // Fix serialization issues with exception class + var converted = t instanceof CommandLine.UnmatchedArgumentException u ? new IllegalArgumentException(u.getMessage()) : t; + var e = ErrorEvent.fromThrowable(converted).term().build(); // Print error in case we launched from the command-line new LogErrorHandler().handle(e); e.handle(); diff --git a/app/src/main/java/io/xpipe/app/storage/DataNames.java b/app/src/main/java/io/xpipe/app/storage/DataNames.java deleted file mode 100644 index 16d0716cd..000000000 --- a/app/src/main/java/io/xpipe/app/storage/DataNames.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.xpipe.app.storage; - -public class DataNames { - - public static String cleanName(String name) { - return name.replaceAll("[\\\\/:*?\"<>|]", "_"); - } -} diff --git a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java index 6d5a12a0a..73debdf25 100644 --- a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java @@ -76,9 +76,8 @@ public class TerminalLauncher { type.launch(config); latch.await(); } catch (Exception ex) { - var modMsg = ex.getMessage() != null && ex.getMessage().contains("Unable to find application named") ? ex.getMessage() + " in installed Applications on this system" : ex; - throw ErrorEvent.expected(new IOException( - "Unable to launch terminal " + type.toTranslatedString().getValue() + ": " + modMsg, ex)); + var modMsg = ex.getMessage() != null && ex.getMessage().contains("Unable to find application named") ? ex.getMessage() + " in installed Applications on this system" : ex.getMessage(); + throw ErrorEvent.expected(new IOException("Unable to launch terminal " + type.toTranslatedString().getValue() + ": " + modMsg, ex)); } } } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseCompressAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseCompressAction.java index fb35c519f..5d31dec18 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseCompressAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseCompressAction.java @@ -268,7 +268,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction @Override protected void create(String fileName, OpenFileSystemModel model, List entries) { - var tar = CommandBuilder.of().add("tar", "-c", "-v").addIf(gz, "-z").add("-f").addFile(fileName); + var tar = CommandBuilder.of().add("tar", "-c").addIf(gz, "-z").add("-f").addFile(fileName); var base = new FilePath(model.getCurrentDirectory().getPath()); if (directory) { diff --git a/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseUntarAction.java b/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseUntarAction.java index 2120ba47d..3e02f05cb 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseUntarAction.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/browser/compress/BaseUntarAction.java @@ -44,7 +44,7 @@ public class BaseUntarAction implements ApplicationPathAction, LeafAction { if (toDirectory) { c.add("-C").addFile(target); } - c.add("-xv").addIf(gz, "-z").add("-f"); + c.add("-x").addIf(gz, "-z").add("-f"); c.addFile(entry.getRawFileEntry().getPath()); if (toDirectory) { model.getFileSystem().mkdirs(target);