Browser improvements

This commit is contained in:
crschnick
2023-05-25 22:29:24 +00:00
parent ff2956ef29
commit 8d9b4c9d4e
22 changed files with 276 additions and 71 deletions

View File

@@ -2,6 +2,7 @@ package io.xpipe.core.process;
import io.xpipe.core.impl.FileNames;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.stream.Collectors;
@@ -33,6 +34,8 @@ public sealed interface OsType permits OsType.Windows, OsType.Linux, OsType.MacO
return FileNames.join(getXPipeHomeDirectory(pc), "system_id");
}
List<String> determineInterestingPaths(ShellControl pc) throws Exception;
String getHomeDirectory(ShellControl pc) throws Exception;
String getFileSystemSeparator();
@@ -47,6 +50,12 @@ public sealed interface OsType permits OsType.Windows, OsType.Linux, OsType.MacO
static final class Windows implements OsType {
@Override
public List<String> determineInterestingPaths(ShellControl pc) throws Exception {
var home = getHomeDirectory(pc);
return List.of(FileNames.join(home, "Desktop"));
}
@Override
public String getHomeDirectory(ShellControl pc) throws Exception {
return pc.executeSimpleStringCommand(
@@ -99,6 +108,12 @@ public sealed interface OsType permits OsType.Windows, OsType.Linux, OsType.MacO
static final class Linux implements OsType {
@Override
public List<String> determineInterestingPaths(ShellControl pc) throws Exception {
var home = getHomeDirectory(pc);
return List.of(FileNames.join(home, "Desktop"));
}
@Override
public String getHomeDirectory(ShellControl pc) throws Exception {
return pc.executeSimpleStringCommand(pc.getShellDialect().getPrintEnvironmentVariableCommand("HOME"));
@@ -162,6 +177,12 @@ public sealed interface OsType permits OsType.Windows, OsType.Linux, OsType.MacO
static final class MacOs implements OsType {
@Override
public List<String> determineInterestingPaths(ShellControl pc) throws Exception {
var home = getHomeDirectory(pc);
return List.of(FileNames.join(home, "Desktop"));
}
@Override
public String getHomeDirectory(ShellControl pc) throws Exception {
return pc.executeSimpleStringCommand(pc.getShellDialect().getPrintEnvironmentVariableCommand("HOME"));