提交 75604676 authored 作者: noelgrandin's avatar noelgrandin

Make Server#openBrowser respect the $BROWSER environment variable.

Add "chromium" to the list of browsers tried.
Patch from Felix Kaiser.
上级 ffc2de54
...@@ -590,6 +590,13 @@ public class Server extends Tool implements Runnable, ShutdownHandler { ...@@ -590,6 +590,13 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
String osName = StringUtils.toLowerEnglish(Utils.getProperty("os.name", "linux")); String osName = StringUtils.toLowerEnglish(Utils.getProperty("os.name", "linux"));
Runtime rt = Runtime.getRuntime(); Runtime rt = Runtime.getRuntime();
String browser = Utils.getProperty(SysProperties.H2_BROWSER, null); String browser = Utils.getProperty(SysProperties.H2_BROWSER, null);
if (browser == null) {
// under Linux, this will point to the default system browser
try {
browser = System.getenv("BROWSER");
} catch (SecurityException se) {
}
}
if (browser != null) { if (browser != null) {
if (browser.startsWith("call:")) { if (browser.startsWith("call:")) {
browser = browser.substring("call:".length()); browser = browser.substring("call:".length());
...@@ -632,7 +639,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler { ...@@ -632,7 +639,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
// Mac OS: to open a page with Safari, use "open -a Safari" // Mac OS: to open a page with Safari, use "open -a Safari"
Runtime.getRuntime().exec(new String[] { "open", url }); Runtime.getRuntime().exec(new String[] { "open", url });
} else { } else {
String[] browsers = { "google-chrome", "firefox", "mozilla-firefox", String[] browsers = { "chromium", "google-chrome", "firefox", "mozilla-firefox",
"mozilla", "konqueror", "netscape", "opera", "midori" }; "mozilla", "konqueror", "netscape", "opera", "midori" };
boolean ok = false; boolean ok = false;
for (String b : browsers) { for (String b : browsers) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论