mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Various fixes
This commit is contained in:
parent
68d3c4263b
commit
12e4ccb995
6 changed files with 20 additions and 9 deletions
|
@ -67,13 +67,15 @@ public final class OpenFileSystemModel {
|
|||
&& fileSystem.getShell().get().getLock().isLocked());
|
||||
}
|
||||
|
||||
private void startIfNeeded() {
|
||||
private void startIfNeeded() throws Exception {
|
||||
if (fileSystem == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var s = fileSystem.getShell();
|
||||
s.ifPresent(ShellControl::start);
|
||||
if (s.isPresent()) {
|
||||
s.get().start();
|
||||
}
|
||||
}
|
||||
|
||||
public void withShell(FailableConsumer<ShellControl, Exception> c, boolean refresh) {
|
||||
|
@ -151,8 +153,13 @@ public final class OpenFileSystemModel {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
// Start shell in case we exited
|
||||
startIfNeeded();
|
||||
try {
|
||||
// Start shell in case we exited
|
||||
startIfNeeded();
|
||||
} catch (Exception ex) {
|
||||
ErrorEvent.fromThrowable(ex).handle();
|
||||
return Optional.ofNullable(currentPath.get());
|
||||
}
|
||||
|
||||
// Fix common issues with paths
|
||||
var adjustedPath = FileSystemHelper.adjustPath(this, path);
|
||||
|
|
|
@ -85,6 +85,10 @@ public class ErrorEvent {
|
|||
return t;
|
||||
}
|
||||
|
||||
public static void preconfigure(ErrorEventBuilder event) {
|
||||
EVENT_BASES.put(event.throwable, event);
|
||||
}
|
||||
|
||||
public void attachUserReport(String email, String text) {
|
||||
this.email = email;
|
||||
userReport = text;
|
||||
|
|
|
@ -13,12 +13,12 @@ public class LocalShell {
|
|||
private static ShellControl local;
|
||||
private static ShellControl localPowershell;
|
||||
|
||||
public static void init() {
|
||||
public static void init() throws Exception {
|
||||
local = ProcessControlProvider.get().createLocalProcessControl(false).start();
|
||||
localCache = new ShellControlCache(local);
|
||||
}
|
||||
|
||||
public static ShellControl getLocalPowershell() {
|
||||
public static ShellControl getLocalPowershell() throws Exception {
|
||||
if (localPowershell == null) {
|
||||
localPowershell = ProcessControlProvider.get()
|
||||
.createLocalProcessControl(true)
|
||||
|
|
|
@ -76,7 +76,7 @@ public interface ShellControl extends ProcessControl {
|
|||
ShellControl withExceptionConverter(ExceptionConverter converter);
|
||||
|
||||
@Override
|
||||
ShellControl start();
|
||||
ShellControl start() throws Exception;
|
||||
|
||||
ShellControl withErrorFormatter(Function<String, String> formatter);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ConnectionFileSystem implements FileSystem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FileSystem open() {
|
||||
public FileSystem open() throws Exception {
|
||||
shellControl.start();
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface FileSystem extends Closeable, AutoCloseable {
|
|||
|
||||
Optional<ShellControl> getShell();
|
||||
|
||||
FileSystem open();
|
||||
FileSystem open() throws Exception;
|
||||
|
||||
InputStream openInput(String file) throws Exception;
|
||||
|
||||
|
|
Loading…
Reference in a new issue