mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-22 15:40:31 -04:00
Rework
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -47,7 +47,7 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
||||
|
||||
@Override
|
||||
public Optional<Path> determineInstallation() {
|
||||
return Optional.of(Path.of(System.getenv("SystemRoot") + "\\System32\\notepad.exe"));
|
||||
return Optional.of(AppLocations.getWindows().getSystemRoot().resolve("\\System32\\notepad.exe"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user