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..91b2c28c9badec05a0cf34170fcbc40111f9f12e 100644 |
| --- a/chrome/installer/util/install_util.cc |
| +++ b/chrome/installer/util/install_util.cc |
| @@ -365,10 +365,23 @@ 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| |
| + typedef std::vector<base::FilePath::StringType>::const_reverse_iterator |
|
gab
2013/09/11 21:26:29
I would put the typedef right before the for loop
|
| + ComponentsIterator; |
| + std::vector<base::FilePath::StringType> components; |
| + exe_dir.GetComponents(&components); |
| + for (ComponentsIterator current = components.rbegin(), parent = current+1; |
|
gab
2013/09/11 21:26:29
Need to check:
if (components.size() < 2)
retur
gab
2013/09/11 21:26:29
Spaces on each side of '+' sign.
|
| + parent != components.rend(); current = parent++) { |
| + if (base::FilePath::CompareEqualIgnoreCase(*current, |
|
grt (UTC plus 2)
2013/09/11 21:39:34
move *current to next line as was done in uninstal
|
| + installer::kInstallBinaryDir)) { |
| + if (base::FilePath::CompareEqualIgnoreCase(*parent, chrome_sxs_dir)) |
|
gab
2013/09/11 21:26:29
Use && instead of nesting ifs.
|
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| } |
| bool InstallUtil::IsChromeSxSProcess() { |