mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-24 08:31:39 -04:00
Various fixes
This commit is contained in:
@@ -49,7 +49,7 @@ public interface ShellDialect {
|
||||
|
||||
String prepareTerminalEnvironmentCommands();
|
||||
|
||||
String addToPathVariableCommand(List<String> entry, boolean append);
|
||||
String addToPathVariableCommand(List<String> entries, boolean append);
|
||||
|
||||
default String applyRcFileCommand() {
|
||||
return null;
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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<DataStoreEntryRef<ScriptStore>> initScripts,
|
||||
List<DataStoreEntryRef<ScriptStore>> 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()) {
|
||||
|
||||
Reference in New Issue
Block a user