Chromium Code Reviews| Index: chrome/installer/util/install_util.cc |
| diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc |
| index c8c037df823364a081b3ebac240cb974244d3e27..0bdb454d1dee11e0858e1a9bcfc06b6c3fbc7c39 100644 |
| --- a/chrome/installer/util/install_util.cc |
| +++ b/chrome/installer/util/install_util.cc |
| @@ -365,10 +365,27 @@ bool CheckIsChromeSxSProcess() { |
| PathService::Get(base::DIR_EXE, &exe_dir); |
| string16 chrome_sxs_dir(installer::kGoogleChromeInstallSubDir2); |
| chrome_sxs_dir.append(installer::kSxSSuffix); |
| - return base::FilePath::CompareEqualIgnoreCase( |
| - exe_dir.BaseName().value(), installer::kInstallBinaryDir) && |
| - base::FilePath::CompareEqualIgnoreCase( |
| - exe_dir.DirName().BaseName().value(), chrome_sxs_dir); |
| + |
| + // This is SxS if current EXE is in or under (possibly multiple levels under) |
| + // |chrome_sxs_dir|\|installer::kInstallBinaryDir| |
| + std::vector<base::FilePath::StringType> components; |
| + exe_dir.GetComponents(&components); |
| + auto iter = components.rbegin(); |
|
grt (UTC plus 2)
2013/09/09 18:39:15
i don't believe auto is approved for use yet. plea
|
| + while (iter != components.rend()) { |
| + auto next = iter+1; |
| + |
| + if (base::FilePath::CompareEqualIgnoreCase(*iter, |
| + installer::kInstallBinaryDir)) { |
| + |
| + if (next != components.rend() && |
| + (base::FilePath::CompareEqualIgnoreCase(*next, chrome_sxs_dir))) |
| + return true; |
| + } |
| + |
| + iter = next; |
| + } |
| + |
| + return false; |
| } |
| bool InstallUtil::IsChromeSxSProcess() { |