This commit is contained in:
Vladimir Krivosheev
2012-12-26 14:04:03 +04:00
parent 300c359127
commit 3d12ef8bda
3 changed files with 9 additions and 19 deletions
@@ -227,18 +227,18 @@ public class BrowserUtil {
}
@NotNull
public static List<String> getOpenBrowserCommand(@NonNls @NotNull String browserPath) {
if (new File(browserPath).isFile()) {
return newSmartList(browserPath);
public static List<String> getOpenBrowserCommand(@NonNls @NotNull String browserPathOrName) {
if (new File(browserPathOrName).isFile()) {
return newSmartList(browserPathOrName);
}
else if (SystemInfo.isMac) {
return newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPath);
return newArrayList(ExecUtil.getOpenCommandPath(), "-a", browserPathOrName);
}
else if (SystemInfo.isWindows) {
return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", "\"\"", browserPath);
return newArrayList(ExecUtil.getWindowsShellName(), "/c", "start", "\"\"", browserPathOrName);
}
else {
return newSmartList(browserPath);
return newSmartList(browserPathOrName);
}
}
@@ -350,7 +350,7 @@ public class BrowserUtil {
myImportantOnly = importantOnly;
}
public boolean accept(File dir, String name) {
public boolean accept(@NotNull File dir, @NotNull String name) {
indicator.checkCanceled();
boolean result = myImportantOnly == myImportantDirs.contains(dir);
if (result) {
@@ -24,9 +24,7 @@ import com.intellij.openapi.components.*;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.io.WindowsRegistryUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.HashMap;
import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
import com.intellij.util.xmlb.XmlSerializer;
@@ -57,7 +55,7 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
return new FirefoxSettings();
}
},
CHROME(XmlBundle.message("browsers.chrome"), getWindowsPathToChrome(), "google-chrome", "Google Chrome", AllIcons.Xml.Browsers.Chrome16) {
CHROME(XmlBundle.message("browsers.chrome"), "chrome", "google-chrome", "Google Chrome", AllIcons.Xml.Browsers.Chrome16) {
@Override
public BrowserSpecificSettings createBrowserSpecificSettings() {
return new ChromeSettings();
@@ -207,14 +205,6 @@ public class BrowsersConfiguration implements PersistentStateComponent<Element>
}
}
@Nullable
private static String getWindowsPathToChrome() {
if (!SystemInfo.isWindows) return null;
String localSettings = SystemProperties.getUserHome() + (SystemInfo.isWin7OrNewer ? "/AppData/Local" : "/Local Settings");
return FileUtil.toSystemDependentName(localSettings + "/Google/Chrome/Application/chrome.exe");
}
public static void launchBrowser(final @NotNull BrowserFamily family, @NotNull final String url, String... parameters) {
launchBrowser(family, url, false, parameters);
}
@@ -78,7 +78,7 @@ public class DefaultUrlOpener extends UrlOpener {
List<String> command = BrowserUtil.getOpenBrowserCommand(browserPath);
addArgs(command, browserArgs, url, forceOpenNewInstanceOnMac);
if (LOG.isDebugEnabled()) {
LOG.debug("Launching browser: " + StringUtil.join(browserArgs, " "));
LOG.debug("Launching browser: " + StringUtil.join(command, " "));
}
new ProcessBuilder(command).start();
}