From 02446b95ecc69700158ec028fbfebd22efb6c7be Mon Sep 17 00:00:00 2001 From: benfry Date: Thu, 5 Nov 2009 02:04:33 +0000 Subject: [PATCH] use xdg-open as launcher on linux (bug #1358) --- app/src/processing/app/linux/Platform.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/processing/app/linux/Platform.java b/app/src/processing/app/linux/Platform.java index 7f227596f..422780b57 100644 --- a/app/src/processing/app/linux/Platform.java +++ b/app/src/processing/app/linux/Platform.java @@ -67,10 +67,18 @@ public class Platform extends processing.app.Platform { return true; } + // Attempt to use xdg-open + try { + Process p = Runtime.getRuntime().exec(new String[] { "xdg-open" }); + p.waitFor(); + Preferences.set("launcher", "xdg-open"); + return true; + } catch (Exception e) { } + // Attempt to use gnome-open try { Process p = Runtime.getRuntime().exec(new String[] { "gnome-open" }); - /*int result =*/ p.waitFor(); + p.waitFor(); // Not installed will throw an IOException (JDK 1.4.2, Ubuntu 7.04) Preferences.set("launcher", "gnome-open"); return true; @@ -79,7 +87,7 @@ public class Platform extends processing.app.Platform { // Attempt with kde-open try { Process p = Runtime.getRuntime().exec(new String[] { "kde-open" }); - /*int result =*/ p.waitFor(); + p.waitFor(); Preferences.set("launcher", "kde-open"); return true; } catch (Exception e) { } @@ -100,7 +108,8 @@ public class Platform extends processing.app.Platform { e.printStackTrace(); } } else { - System.out.println("not available"); + System.out.println("No launcher set, cannot open " + + file.getAbsolutePath()); } } }