diff --git a/app/src/main/java/io/xpipe/app/update/AppInstaller.java b/app/src/main/java/io/xpipe/app/update/AppInstaller.java index 89f49cd02..1bd232aa3 100644 --- a/app/src/main/java/io/xpipe/app/update/AppInstaller.java +++ b/app/src/main/java/io/xpipe/app/update/AppInstaller.java @@ -74,7 +74,7 @@ public class AppInstaller { } if (p.getOsType().equals(OsType.LINUX)) { - try (CommandControl c = p.command(p.getShellDialect().getFileExistsCommand("/etc/debian_version")) + try (CommandControl c = p.getShellDialect().createFileExistsCommand(p, "/etc/debian_version") .start()) { return c.discardAndCheckExit() ? new InstallerAssetType.Debian() : new InstallerAssetType.Rpm(); } diff --git a/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java b/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java index 573d8344c..9955d632c 100644 --- a/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java +++ b/app/src/main/java/io/xpipe/app/util/ProxyManagerProviderImpl.java @@ -41,7 +41,7 @@ public class ProxyManagerProviderImpl extends ProxyManagerProvider { var defaultInstallationExecutable = FileNames.join( XPipeInstallation.getDefaultInstallationBasePath(s, false), XPipeInstallation.getDaemonExecutablePath(s.getOsType())); - if (!s.executeBooleanSimpleCommand(s.getShellDialect().getFileExistsCommand(defaultInstallationExecutable))) { + if (!s.getShellDialect().createFileExistsCommand(s, defaultInstallationExecutable).executeAndCheck()) { return Optional.of(AppI18n.get("noInstallationFound")); } diff --git a/core/src/main/java/io/xpipe/core/impl/FileStore.java b/core/src/main/java/io/xpipe/core/impl/FileStore.java index a58cb62ae..0e549865b 100644 --- a/core/src/main/java/io/xpipe/core/impl/FileStore.java +++ b/core/src/main/java/io/xpipe/core/impl/FileStore.java @@ -82,7 +82,7 @@ public class FileStore extends JacksonizedValue implements FilenameStore, Stream @Override public boolean canOpen() throws Exception { - return fileSystem.createFileSystem().open().exists(path); + return fileSystem.createFileSystem().open().fileExists(path); } @Override diff --git a/core/src/main/java/io/xpipe/core/process/ShellDialect.java b/core/src/main/java/io/xpipe/core/process/ShellDialect.java index bbca88429..936a81fb3 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellDialect.java +++ b/core/src/main/java/io/xpipe/core/process/ShellDialect.java @@ -123,7 +123,7 @@ public interface ShellDialect { String getFileDeleteCommand(String file); - String getFileExistsCommand(String file); + CommandControl createFileExistsCommand(ShellControl sc, String file); String getFileTouchCommand(String file); diff --git a/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java b/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java index c51d76f68..b67b9e40f 100644 --- a/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java +++ b/core/src/main/java/io/xpipe/core/store/ConnectionFileSystem.java @@ -76,9 +76,9 @@ public class ConnectionFileSystem implements FileSystem { } @Override - public boolean exists(String file) throws Exception { - try (var pc = shellControl.command(proc -> proc.getShellDialect() - .getFileExistsCommand(file)).complex() + public boolean fileExists(String file) throws Exception { + try (var pc = shellControl.getShellDialect() + .createFileExistsCommand(shellControl, file).complex() .start()) { return pc.discardAndCheckExit(); } diff --git a/core/src/main/java/io/xpipe/core/store/FileSystem.java b/core/src/main/java/io/xpipe/core/store/FileSystem.java index d17d81c42..a59e4d1ba 100644 --- a/core/src/main/java/io/xpipe/core/store/FileSystem.java +++ b/core/src/main/java/io/xpipe/core/store/FileSystem.java @@ -51,7 +51,7 @@ public interface FileSystem extends Closeable, AutoCloseable { OutputStream openOutput(String file) throws Exception; - public boolean exists(String file) throws Exception; + public boolean fileExists(String file) throws Exception; public void delete(String file) throws Exception; diff --git a/core/src/main/java/io/xpipe/core/util/XPipeSession.java b/core/src/main/java/io/xpipe/core/util/XPipeSession.java index e21da67ab..fff45ad49 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeSession.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeSession.java @@ -42,6 +42,7 @@ public class XPipeSession { : UuidHelper.parse(() -> Files.readString(sessionFile)).orElse(UUID.randomUUID()); try { + //TODO: People might move their page file to another drive if (OsType.getLocal().equals(OsType.WINDOWS)) { var pf = Path.of("C:\\pagefile.sys"); BasicFileAttributes attr = Files.readAttributes(pf, BasicFileAttributes.class); diff --git a/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java b/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java index d9429661b..717fb6160 100644 --- a/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java +++ b/core/src/main/java/io/xpipe/core/util/XPipeTempDirectory.java @@ -23,7 +23,7 @@ public class XPipeTempDirectory { var base = proc.getOsType().getTempDirectory(proc); var dir = FileNames.join(base, "xpipe"); - if (!proc.executeBooleanSimpleCommand(proc.getShellDialect().getFileExistsCommand(dir))) { + if (!proc.getShellDialect().createFileExistsCommand(proc, dir).executeAndCheck()) { proc.executeSimpleCommand(proc.getShellDialect().getMkdirsCommand(dir), "Unable to access or create temporary directory " + dir);