Various small fixes

This commit is contained in:
crschnick 2024-10-06 23:38:50 +00:00
parent b7b3acf168
commit 99d867965b
7 changed files with 12 additions and 16 deletions

View file

@ -46,8 +46,7 @@ public interface BrowserAction {
default List<BrowserEntry> resolveFilesIfNeeded(List<BrowserEntry> 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;
}

View file

@ -54,6 +54,10 @@ public class AppLayoutModel {
}
public static void reset() {
if (INSTANCE == null) {
return;
}
AppCache.update("layoutState", INSTANCE.savedState);
INSTANCE = null;
}

View file

@ -74,7 +74,9 @@ public class LauncherCommand implements Callable<Integer> {
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();

View file

@ -1,8 +0,0 @@
package io.xpipe.app.storage;
public class DataNames {
public static String cleanName(String name) {
return name.replaceAll("[\\\\/:*?\"<>|]", "_");
}
}

View file

@ -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));
}
}
}

View file

@ -268,7 +268,7 @@ public abstract class BaseCompressAction implements BrowserAction, BranchAction
@Override
protected void create(String fileName, OpenFileSystemModel model, List<BrowserEntry> 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) {

View file

@ -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);