This commit is contained in:
crschnick
2025-06-18 13:46:03 +00:00
parent c06f49ef98
commit 3abd7e75f3
27 changed files with 36 additions and 99 deletions
@@ -2,7 +2,6 @@ package io.xpipe.app.browser.file;
import io.xpipe.app.comp.SimpleComp;
import io.xpipe.app.util.PlatformThread;
import io.xpipe.core.store.FileNames;
import io.xpipe.core.store.FilePath;
import javafx.scene.Node;
@@ -28,7 +27,7 @@ public class BrowserBreadcrumbBar extends SimpleComp {
@Override
protected Region createSimple() {
Callback<Breadcrumbs.BreadCrumbItem<String>, ButtonBase> crumbFactory = crumb -> {
var name = crumb.getValue().equals("/") ? "/" : FileNames.getFileName(crumb.getValue());
var name = crumb.getValue().equals("/") ? "/" : FilePath.of(crumb.getValue()).getFileName();
var btn = new Button(name, null);
btn.setMnemonicParsing(false);
btn.setFocusTraversable(false);
@@ -2,7 +2,6 @@ package io.xpipe.app.browser.file;
import io.xpipe.app.storage.DataStoreEntry;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Optional;
@@ -166,7 +166,7 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab<File
});
}
public void refreshSync() throws Exception {
public void refreshSync() {
cdSyncWithoutCheck(currentPath.get());
}
@@ -188,9 +188,8 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab<File
}
public FileEntry getCurrentParentDirectory() {
var current = getCurrentDirectory();
if (current == null) {
return null;
if (currentPath.get() == null) {
return FileEntry.ofDirectory(fileSystem, FilePath.of("?"));
}
var parent = currentPath.get().getParent();
@@ -202,8 +201,10 @@ public final class BrowserFileSystemTabModel extends BrowserStoreSessionTab<File
}
public FileEntry getCurrentDirectory() {
// This should never happen, this should not be called in a context
// where the current path is null
if (currentPath.get() == null) {
return null;
return FileEntry.ofDirectory(fileSystem, FilePath.of("?"));
}
return new FileEntry(fileSystem, currentPath.get(), null, null, null, FileKind.DIRECTORY);
@@ -5,7 +5,6 @@ import io.xpipe.core.util.JacksonMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import org.apache.commons.io.FileUtils;
@@ -51,7 +51,7 @@ public class CloneHubLeafProvider implements HubLeafProvider<DataStore> {
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<DataStore> {
public static class Action extends StoreAction<DataStore> {
@Override
public void executeImpl() {
@@ -48,7 +48,7 @@ public class EditHubLeafProvider implements HubLeafProvider<DataStore> {
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<DataStore> {
public static class Action extends StoreAction<DataStore> {
@Override
public void executeImpl() {
@@ -58,7 +58,7 @@ public class RefreshChildrenHubLeafProvider implements HubLeafProvider<FixedHier
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<FixedHierarchyStore> {
public static class Action extends StoreAction<FixedHierarchyStore> {
@Override
public void executeImpl() {
@@ -68,7 +68,7 @@ public class ScanHubLeafProvider implements HubLeafProvider<ShellStore> {
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<ShellStore> {
public static class Action extends StoreAction<ShellStore> {
@Override
public void executeImpl() {
@@ -66,7 +66,7 @@ public class PasswordManagerTestComp extends SimpleComp {
.tooltip(AppI18n.observable("test"))
.styleClass(Styles.RIGHT_PILL);
var testInput = new HorizontalComp(List.<Comp<?>>of(field, button));
var testInput = new HorizontalComp(List.of(field, button));
testInput.apply(struc -> {
struc.get().setFillHeight(true);
var first = ((Region) struc.get().getChildren().get(0));
@@ -1,5 +1,6 @@
package io.xpipe.app.pwman;
import lombok.Getter;
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;
import org.bouncycastle.crypto.KeyGenerationParameters;
import org.bouncycastle.crypto.agreement.X25519Agreement;
@@ -26,6 +27,7 @@ public class TweetNaClHelper {
// Sigma constant ("expand 32-byte k")
private static final byte[] SIGMA = {101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107};
@Getter
public static class KeyPair {
private final byte[] publicKey;
private final byte[] secretKey;
@@ -34,14 +36,6 @@ public class TweetNaClHelper {
this.publicKey = publicKey;
this.secretKey = secretKey;
}
public byte[] getPublicKey() {
return publicKey;
}
public byte[] getSecretKey() {
return secretKey;
}
}
/**
@@ -5,7 +5,7 @@ import io.xpipe.app.core.AppProperties;
import io.xpipe.app.issue.ErrorEventFactory;
import io.xpipe.app.util.LocalShell;
import io.xpipe.core.process.CommandBuilder;
import io.xpipe.core.store.FileNames;
import io.xpipe.core.store.FilePath;
import io.xpipe.core.util.JacksonMapper;
import io.xpipe.core.util.XPipeInstallation;
@@ -38,8 +38,8 @@ public interface WindowsTerminalType extends ExternalTerminalType, TrackableTerm
// A weird behavior in Windows Terminal causes the trailing
// backslash of a filepath to escape the closing quote in the title argument
// So just remove that slash
var fixedName = FileNames.removeTrailingSlash(configuration.getColoredTitle());
cmd.add("--title").addQuoted(fixedName);
var fixedName = FilePath.of(configuration.getColoredTitle()).removeTrailingSlash();
cmd.add("--title").addQuoted(fixedName.toString());
cmd.add("--profile").addQuoted("{021eff0f-b38a-45f9-895d-41467e9d510f}");
cmd.add(configuration.getDialectLaunchCommand());
return cmd;
@@ -19,8 +19,13 @@ public class ModuleAccess {
break;
}
}
modifiers.setAccessible(true);
// Maybe an unknown JDK version?
if (modifiers == null) {
return;
}
modifiers.setAccessible(true);
modifiers.invoke(source, pkg, target, false, true);
modifiers.invoke(source, pkg, target, true, true);
}
@@ -1,42 +1,10 @@
package io.xpipe.core.store;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class FileNames {
public static String quoteIfNecessary(String n) {
return n.contains(" ") ? "\"" + n + "\"" : n;
}
public static String toDirectory(String path) {
if (path == null) {
return null;
}
if (path.endsWith("/") || path.endsWith("\\")) {
return path;
}
if (path.contains("\\")) {
return path + "\\";
}
return path + "/";
}
public static String removeTrailingSlash(String path) {
if (path.equals("/")) {
return path;
}
if (path.endsWith("/") || path.endsWith("\\")) {
return path.substring(0, path.length() - 1);
}
return path;
}
public static String getFileName(String file) {
if (file == null) {
return null;
@@ -58,26 +26,6 @@ public class FileNames {
return components.getLast();
}
public static List<String> splitHierarchy(String file) {
if (file.isEmpty()) {
return List.of();
}
file = file + "/";
var list = new ArrayList<String>();
int lastElementStart = 0;
for (int i = 0; i < file.length(); i++) {
if (file.charAt(i) == '\\' || file.charAt(i) == '/') {
if (i - lastElementStart > 0) {
list.add(file.substring(0, i));
}
lastElementStart = i + 1;
}
}
return list;
}
public static String getBaseName(String file) {
if (file == null || file.isEmpty()) {
return null;
@@ -132,13 +80,6 @@ public class FileNames {
return file.substring(0, file.length() - getFileName(file).length() - 1);
}
public static boolean startsWith(String file, String start) {
return normalize(file).startsWith(normalize(start));
}
public static String relativize(String from, String to) {
return normalize(to).substring(FileNames.toDirectory(normalize(from)).length());
}
public static String normalize(String file) {
var backslash = file.contains("\\");
@@ -61,7 +61,7 @@ public class LocalIdentityConvertActionProvider implements HubLeafProvider<Local
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<LocalIdentityStore> {
public static class Action extends StoreAction<LocalIdentityStore> {
@Override
public void executeImpl() {
@@ -58,7 +58,7 @@ public class SimpleScriptQuickEditActionProvider implements HubLeafProvider<Simp
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<SimpleScriptStore> {
public static class Action extends StoreAction<SimpleScriptStore> {
@Override
public void executeImpl() {
@@ -53,7 +53,7 @@ public class ServiceCopyAddressActionProvider implements HubLeafProvider<Abstrac
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<AbstractServiceStore> {
public static class Action extends StoreAction<AbstractServiceStore> {
@Override
public void executeImpl() throws Exception {
@@ -69,7 +69,7 @@ public class ServiceRefreshActionProvider
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<FixedServiceCreatorStore> {
public static class Action extends StoreAction<FixedServiceCreatorStore> {
@Override
public void executeImpl() {
-1
View File
@@ -1,7 +1,6 @@
import io.xpipe.app.action.ActionProvider;
import io.xpipe.app.ext.DataStorageExtensionProvider;
import io.xpipe.app.ext.DataStoreProvider;
import io.xpipe.app.hub.action.impl.*;
import io.xpipe.ext.base.desktop.DesktopApplicationStoreProvider;
import io.xpipe.ext.base.identity.*;
import io.xpipe.ext.base.script.*;
@@ -47,7 +47,7 @@ public class IncusContainerConsoleActionProvider implements HubLeafProvider<Incu
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<IncusContainerStore> {
public static class Action extends StoreAction<IncusContainerStore> {
@Override
public void executeImpl() throws Exception {
@@ -47,7 +47,7 @@ public class IncusContainerEditConfigActionProvider implements HubLeafProvider<I
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<IncusContainerStore> {
public static class Action extends StoreAction<IncusContainerStore> {
@Override
public boolean isMutation() {
@@ -51,7 +51,7 @@ public class IncusContainerEditRunConfigActionProvider implements HubLeafProvide
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<IncusContainerStore> {
public static class Action extends StoreAction<IncusContainerStore> {
@Override
public boolean isMutation() {
@@ -48,7 +48,7 @@ public class LxdContainerConsoleActionProvider implements HubLeafProvider<LxdCon
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<LxdContainerStore> {
public static class Action extends StoreAction<LxdContainerStore> {
@Override
public void executeImpl() throws Exception {
@@ -48,7 +48,7 @@ public class LxdContainerEditConfigActionProvider implements HubLeafProvider<Lxd
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<LxdContainerStore> {
public static class Action extends StoreAction<LxdContainerStore> {
@Override
public boolean isMutation() {
@@ -51,7 +51,7 @@ public class LxdContainerEditRunConfigActionProvider implements HubLeafProvider<
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<LxdContainerStore> {
public static class Action extends StoreAction<LxdContainerStore> {
@Override
public boolean isMutation() {
@@ -41,7 +41,7 @@ public class PodmanContainerAttachActionProvider implements HubLeafProvider<Podm
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<PodmanContainerStore> {
public static class Action extends StoreAction<PodmanContainerStore> {
@Override
public void executeImpl() throws Exception {
@@ -42,7 +42,7 @@ public class PodmanContainerInspectActionProvider implements HubLeafProvider<Pod
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<PodmanContainerStore> {
public static class Action extends StoreAction<PodmanContainerStore> {
@Override
public void executeImpl() throws Exception {
@@ -42,7 +42,7 @@ public class PodmanContainerLogsActionProvider implements HubLeafProvider<Podman
@Jacksonized
@SuperBuilder
static class Action extends StoreAction<PodmanContainerStore> {
public static class Action extends StoreAction<PodmanContainerStore> {
@Override
public void executeImpl() throws Exception {