mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-17 04:36:02 +00:00
Fix JfxRevealPathService opens the file instead of revealing
also set priority to "Fallback" Signed-off-by: Armin Schrenk <armin.schrenk@skymatic.de>
This commit is contained in:
@@ -6,6 +6,7 @@ import org.cryptomator.integrations.common.Priority;
|
||||
import org.cryptomator.integrations.revealpath.RevealFailedException;
|
||||
import org.cryptomator.integrations.revealpath.RevealPathService;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
@@ -17,14 +18,16 @@ import java.nio.file.Path;
|
||||
*/
|
||||
@DisplayName("JavaFX HostServices (GTK)")
|
||||
@OperatingSystem(OperatingSystem.Value.LINUX)
|
||||
@Priority(10)
|
||||
@Priority(Priority.FALLBACK)
|
||||
public class JfxRevealPathService implements RevealPathService {
|
||||
|
||||
@Override
|
||||
public void reveal(Path p) throws RevealFailedException {
|
||||
var fxApp = FxApplication.INSTANCE.get();
|
||||
if (fxApp != null) {
|
||||
fxApp.getHostServices().showDocument(p.toUri().toString());
|
||||
// showDocument() launches the default app for a regular file, so reveal its parent directory instead
|
||||
var target = Files.isRegularFile(p) ? p.getParent() : p;
|
||||
fxApp.getHostServices().showDocument(target.toUri().toString());
|
||||
} else {
|
||||
throw new RevealFailedException("JavaFX Application not initialized");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user