Changeset 6682 in josm
- Timestamp:
- 2014-01-13T19:29:33+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java
r6380 r6682 59 59 // Desktop API works fine under Windows, so we don't try any fallback in case of I/O exceptions because it's not API's fault 60 60 Desktop.getDesktop().browse(uri); 61 } else if (Main.platform instanceof PlatformHookUnixoid) { 62 // see #5629 #5108 #9568 63 Main.platform.openUrl(uri.toString()); 61 64 } else { 62 65 // This is not the case with some Linux environments (see below), and not sure about Mac OS X, so we need to handle API failure -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r6443 r6682 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.Desktop; 6 7 import java.awt.Dimension; 7 8 import java.awt.GraphicsEnvironment; … … 12 13 import java.io.IOException; 13 14 import java.io.InputStreamReader; 15 import java.net.URI; 16 import java.net.URISyntaxException; 14 17 import java.util.Arrays; 15 18 … … 41 44 @Override 42 45 public void openUrl(String url) throws IOException { 43 String[] programs = {"gnome-open", "kfmclient openURL", "firefox"};44 for (String program : programs) {46 for (String program : Main.pref.getCollection("browser.unix", 47 Arrays.asList("xdg-open", "#DESKTOP#", "$BROWSER", "gnome-open", "kfmclient openURL", "firefox"))) { 45 48 try { 46 Runtime.getRuntime().exec(program+" "+url); 49 if ("#DESKTOP#".equals(program)) { 50 Desktop.getDesktop().browse(new URI(url)); 51 } else if (program.startsWith("$")) { 52 program = System.getenv().get(program.substring(1)); 53 Runtime.getRuntime().exec(new String[]{program, url}); 54 } else { 55 Runtime.getRuntime().exec(new String[]{program, url}); 56 } 47 57 return; 48 58 } catch (IOException e) { 59 Main.warn(e); 60 } catch (URISyntaxException e) { 49 61 Main.warn(e); 50 62 }
Note:
See TracChangeset
for help on using the changeset viewer.