Improve working directory handling if it does not exist

This commit is contained in:
crschnick
2024-03-21 03:57:23 +00:00
parent 50defba23d
commit cde12be5c8
2 changed files with 32 additions and 1 deletions

View File

@@ -28,6 +28,8 @@ public interface OsType {
}
}
String getFallbackWorkingDirectory();
List<String> determineInterestingPaths(ShellControl pc) throws Exception;
String getHomeDirectory(ShellControl pc) throws Exception;
@@ -54,6 +56,11 @@ public interface OsType {
final class Windows implements OsType, Local, Any {
@Override
public String getFallbackWorkingDirectory() {
return "C:\\";
}
@Override
public List<String> determineInterestingPaths(ShellControl pc) throws Exception {
var home = getHomeDirectory(pc);
@@ -116,6 +123,11 @@ public interface OsType {
class Unix implements OsType {
@Override
public String getFallbackWorkingDirectory() {
return "/";
}
@Override
public List<String> determineInterestingPaths(ShellControl pc) throws Exception {
var home = getHomeDirectory(pc);
@@ -198,6 +210,11 @@ public interface OsType {
final class MacOs implements OsType, Local, Any {
@Override
public String getFallbackWorkingDirectory() {
return "/";
}
@Override
public List<String> determineInterestingPaths(ShellControl pc) throws Exception {
var home = getHomeDirectory(pc);