Skip to content

Commit 7f1b97b

Browse files
committed
Run xdg-open without checking where it is.
Fixes Slowpoke101#981. In case it doesn't exist, there'll be a different exception; nothing else changes.
1 parent c79e9e7 commit 7f1b97b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/main/java/net/ftb/util/OSUtils.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public static void browse (String url) {
525525
try {
526526
if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
527527
Desktop.getDesktop().browse(new URI(url.replace(" ", "+")));
528-
} else if (getCurrentOS() == OS.UNIX && (new File("/usr/bin/xdg-open").exists() || new File("/usr/local/bin/xdg-open").exists())) {
528+
} else if (getCurrentOS() == OS.UNIX) {
529529
// Work-around to support non-GNOME Linux desktop environments with xdg-open installed
530530
new ProcessBuilder("xdg-open", url).start();
531531
} else {
@@ -549,9 +549,7 @@ public static void open (File path) {
549549
Desktop.getDesktop().open(path);
550550
} else if (getCurrentOS() == OS.UNIX) {
551551
// Work-around to support non-GNOME Linux desktop environments with xdg-open installed
552-
if (new File("/usr/bin/xdg-open").exists() || new File("/usr/local/bin/xdg-open").exists()) {
553-
new ProcessBuilder("xdg-open", path.toString()).start();
554-
}
552+
new ProcessBuilder("xdg-open", path.toString()).start();
555553
}
556554
} catch (Exception e) {
557555
Logger.logError("Could not open file", e);
@@ -767,4 +765,4 @@ static interface Kernel32 extends Library {
767765
public static Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
768766
public int GetProcessId (Long hProcess);
769767
}
770-
}
768+
}

0 commit comments

Comments
 (0)