diff --git a/core/src/main/java/io/xpipe/core/process/ShellDialect.java b/core/src/main/java/io/xpipe/core/process/ShellDialect.java index 77132ef20..577847ea2 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellDialect.java +++ b/core/src/main/java/io/xpipe/core/process/ShellDialect.java @@ -49,7 +49,7 @@ public interface ShellDialect { String prepareTerminalEnvironmentCommands(); - String addToPathVariableCommand(List entry, boolean append); + String addToPathVariableCommand(List entries, boolean append); default String applyRcFileCommand() { return null; diff --git a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java index 1ba4d50be..8aee357ec 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeInstallation.java @@ -42,12 +42,6 @@ public class XPipeInstallation { return Path.of(System.getProperty("user.home"), isStaging() ? ".xpipe-ptb" : ".xpipe"); } - public static String getDataDir(ShellControl p) throws Exception { - var name = isStaging() ? ".xpipe-ptb" : ".xpipe"; - var dir = p.getOsType().getHomeDirectory(p); - return FileNames.join(dir, name); - } - private static String getPkgId() { return isStaging() ? "io.xpipe.xpipe-ptb" : "io.xpipe.xpipe"; } diff --git a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java index 5faa8abf0..53eb6d1e8 100644 --- a/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java +++ b/ext/base/src/main/java/io/xpipe/ext/base/script/ScriptStore.java @@ -13,7 +13,6 @@ import io.xpipe.core.store.DataStoreState; import io.xpipe.core.store.FileNames; import io.xpipe.core.store.StatefulDataStore; import io.xpipe.core.util.JacksonizedValue; -import io.xpipe.core.util.XPipeInstallation; import lombok.*; import lombok.experimental.FieldDefaults; import lombok.experimental.SuperBuilder; @@ -42,6 +41,11 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore, List> initScripts, List> bringScripts) { try { + // Don't copy scripts if we don't want to modify the file system + if (!pc.getEffectiveSecurityPolicy().permitTempScriptCreation()) { + return pc; + } + var initFlattened = flatten(initScripts); var bringFlattened = flatten(bringScripts); @@ -109,9 +113,8 @@ public abstract class ScriptStore extends JacksonizedValue implements DataStore, .mapToInt(value -> value.get().getName().hashCode() + value.getStore().hashCode()) .sum(); - var xpipeHome = XPipeInstallation.getDataDir(proc); var targetDir = - FileNames.join(xpipeHome, "scripts", proc.getShellDialect().getId()); + FileNames.join(proc.getSystemTemporaryDirectory(), "xpipe", "scripts", proc.getShellDialect().getId()); var hashFile = FileNames.join(targetDir, "hash"); var d = proc.getShellDialect(); if (d.createFileExistsCommand(proc, hashFile).executeAndCheck()) {