X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FLocalReaderFrame.java;h=9d39017de82ba212051807934c7951c76070a17a;hb=63985d926fe1649517bc06d8f50761925b4c9984;hp=966869f502c8f9a65d9fe2ef6bd55ee78d698bad;hpb=3b2b638f7e1395702f843b5b19d7959327f604b2;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java b/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java index 966869f..9d39017 100644 --- a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java +++ b/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java @@ -99,7 +99,34 @@ class LocalReaderFrame extends JFrame { try { File target = LocalReaderFrame.this.reader .getTarget(luid, pg); - Desktop.getDesktop().browse(target.toURI()); + // TODO: allow custom programs, with + // Desktop/xdg-open fallback + try { + Desktop.getDesktop().browse(target.toURI()); + } catch (UnsupportedOperationException e) { + String browsers[] = new String[] { + "xdg-open", "epiphany", + "konqueror", "firefox", "chrome", + "google-chrome", "mozilla" }; + + Runtime runtime = Runtime.getRuntime(); + for (String browser : browsers) { + try { + runtime.exec(new String[] { + browser, + target.getAbsolutePath() }); + runtime = null; + break; + } catch (IOException ioe) { + // continue, try next browser + } + } + + if (runtime != null) { + throw new IOException( + "Cannot find a working GUI browser..."); + } + } } catch (IOException e) { Instance.syserr(e); }