From b73bbd1f597c935797c627fccfd39b85c0947e20 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 10 Aug 2025 01:58:26 +0000 Subject: [PATCH] Rework --- app/src/main/java/io/xpipe/app/core/AppLocations.java | 8 ++++++++ app/src/main/java/io/xpipe/app/core/AppSid.java | 2 -- .../java/io/xpipe/app/core/check/AppCertutilCheck.java | 3 ++- .../main/java/io/xpipe/app/prefs/ExternalEditorType.java | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/core/AppLocations.java b/app/src/main/java/io/xpipe/app/core/AppLocations.java index 31b4521fe..f071c3507 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLocations.java +++ b/app/src/main/java/io/xpipe/app/core/AppLocations.java @@ -37,6 +37,14 @@ public interface AppLocations { private Path userHome; + public Path getSystemRoot() { + var root = AppLocations.parsePath(System.getenv("SystemRoot")); + if (root == null) { + return Path.of("C:\\Windows"); + } + return root; + } + public Path getTemp() { var env = AppLocations.parsePath(System.getenv("TEMP")); if (env == null) { diff --git a/app/src/main/java/io/xpipe/app/core/AppSid.java b/app/src/main/java/io/xpipe/app/core/AppSid.java index da962bb61..0363f9d1b 100644 --- a/app/src/main/java/io/xpipe/app/core/AppSid.java +++ b/app/src/main/java/io/xpipe/app/core/AppSid.java @@ -42,8 +42,6 @@ public class AppSid { return; } - if (true) return; - try { // If there is no setsid command, we can't fully prevent commands from accessing any potential parent tty // We can however set the pid to prevent this happening when launched from the cli command diff --git a/app/src/main/java/io/xpipe/app/core/check/AppCertutilCheck.java b/app/src/main/java/io/xpipe/app/core/check/AppCertutilCheck.java index 06eaa5bf9..38ecf5657 100644 --- a/app/src/main/java/io/xpipe/app/core/check/AppCertutilCheck.java +++ b/app/src/main/java/io/xpipe/app/core/check/AppCertutilCheck.java @@ -1,5 +1,6 @@ package io.xpipe.app.core.check; +import io.xpipe.app.core.AppLocations; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.process.ShellDialects; import io.xpipe.app.util.LocalShell; @@ -10,7 +11,7 @@ import java.util.concurrent.TimeUnit; public class AppCertutilCheck { private static boolean getResult() { - var fc = new ProcessBuilder(System.getenv("WINDIR") + "\\System32\\certutil").redirectErrorStream(true); + var fc = new ProcessBuilder(AppLocations.getWindows().getSystemRoot().resolve("\\System32\\certutil").toString()).redirectErrorStream(true); try { var proc = fc.start(); var out = new String(proc.getInputStream().readAllBytes()); diff --git a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java index 5267d78e2..a4df06c26 100644 --- a/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java +++ b/app/src/main/java/io/xpipe/app/prefs/ExternalEditorType.java @@ -47,7 +47,7 @@ public interface ExternalEditorType extends PrefsChoiceValue { @Override public Optional determineInstallation() { - return Optional.of(Path.of(System.getenv("SystemRoot") + "\\System32\\notepad.exe")); + return Optional.of(AppLocations.getWindows().getSystemRoot().resolve("\\System32\\notepad.exe")); } };