From 87065cafd435e3b546052bc611e45b2d7e83ec6f Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 15 Nov 2017 21:37:05 +0100 Subject: [PATCH] If possible, Ubuntu w/ unity now uses gvfs-open instead of xdg-open --- src/dorkbox/util/Desktop.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/dorkbox/util/Desktop.java b/src/dorkbox/util/Desktop.java index 46fbc09..ed98c85 100644 --- a/src/dorkbox/util/Desktop.java +++ b/src/dorkbox/util/Desktop.java @@ -32,6 +32,9 @@ import dorkbox.util.process.ShellExecutor; @SuppressWarnings({"WeakerAccess", "Convert2Lambda", "Duplicates"}) public class Desktop { + // used only for ubuntu + unity + private static final boolean UBUNTU_GVFS_VALID = OSUtil.Linux.isUbuntu() && OSUtil.DesktopEnv.isUnity() && new File("/usr/bin/gvfs-open").canExecute(); + /** * Launches the default browser to display the specified HTTP address. *

@@ -197,7 +200,13 @@ class Desktop { */ private static void launch(final String path) { - if ((OSUtil.Linux.isUbuntu() || OSUtil.DesktopEnv.isGnome()) && GnomeVFS.isInited) { + // ubuntu, once again, takes the cake for stupidity. + if (UBUNTU_GVFS_VALID) { + // ubuntu has access to gvfs-open. Ubuntu is also VERY buggy with xdg-open!! + ShellExecutor.run("gvfs-open", path); + } + + else if (OSUtil.DesktopEnv.isGnome() && GnomeVFS.isInited) { GtkEventDispatch.dispatch(new Runnable() { @Override public