This commit is contained in:
crschnick
2024-04-22 06:01:20 +00:00
parent 8564b2e820
commit 4ca3d2c52c
62 changed files with 216 additions and 281 deletions
@@ -2,7 +2,7 @@ package io.xpipe.core.store;
public interface ExpandedLifecycleStore extends DataStore {
default void initializeValidate() throws Exception {}
default void initializeValidate() {}
default void finalizeValidate() throws Exception {}
}
@@ -3,7 +3,7 @@ package io.xpipe.core.store;
public interface SingletonSessionStore<T extends SingletonSessionStore.Session>
extends ExpandedLifecycleStore, InternalCacheDataStore {
abstract static class Session {
abstract class Session {
public abstract boolean isRunning();
@@ -13,7 +13,7 @@ public interface SingletonSessionStore<T extends SingletonSessionStore.Session>
}
@Override
public default void finalizeValidate() throws Exception {
default void finalizeValidate() throws Exception {
stopSessionIfNeeded();
}
@@ -21,8 +21,7 @@ public interface StatefulDataStore<T extends DataStoreState> extends DataStore {
@SuppressWarnings("unchecked")
default T getState() {
return (T)
DataStateProvider.get().getState(this, this::createDefaultState).deepCopy();
return (T) DataStateProvider.get().getState(this, this::createDefaultState).deepCopy();
}
default void setState(T val) {
@@ -206,15 +206,6 @@ public class XPipeInstallation {
return v;
}
public static String queryInstallationVersion(ShellControl p, String exec) throws Exception {
try (CommandControl c =
p.command(CommandBuilder.of().addFile(exec).add("version")).start()) {
return c.readStdoutOrThrow();
} catch (ProcessOutputException ex) {
return "?";
}
}
public static Path getLocalBundledToolsDirectory() {
Path path = getCurrentInstallationBasePath();
@@ -282,20 +273,6 @@ public class XPipeInstallation {
return path;
}
public static String getDefaultInstallationBasePath(ShellControl p) throws Exception {
String path;
if (p.getOsType().equals(OsType.WINDOWS)) {
var base = p.executeSimpleStringCommand(p.getShellDialect().getPrintVariableCommand("LOCALAPPDATA"));
path = FileNames.join(base, isStaging() ? "XPipe PTB" : "XPipe");
} else if (p.getOsType().equals(OsType.LINUX)) {
path = isStaging() ? "/opt/xpipe-ptb" : "/opt/xpipe";
} else {
path = isStaging() ? "/Applications/XPipe PTB.app" : "/Applications/XPipe.app";
}
return path;
}
public static Path getLangPath() {
if (!ModuleHelper.isImage()) {
return getCurrentInstallationBasePath().resolve("lang");