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..8c1da3add5329282ec1b28dbe878fd1487331c02 100644 |
| --- a/chrome/installer/util/install_util.cc |
| +++ b/chrome/installer/util/install_util.cc |
| @@ -365,10 +365,26 @@ 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); |
| + // We need at least 1 element in the array for the behavior of the following |
| + // loop to be defined. This should always be true, since we're splitting the |
| + // path to our executable. |
|
grt (UTC plus 2)
2013/09/12 14:04:53
this is splitting the dir containing the executabl
gab
2013/09/13 02:02:36
zturner:
|
| + DCHECK(!components.empty()); |
| + typedef std::vector<base::FilePath::StringType>::const_reverse_iterator |
| + ComponentsIterator; |
| + for (ComponentsIterator current = components.rbegin(), parent = current + 1; |
| + parent != components.rend(); current = parent++) { |
| + if (base::FilePath::CompareEqualIgnoreCase( |
| + *current, installer::kInstallBinaryDir) && |
| + base::FilePath::CompareEqualIgnoreCase(*parent, chrome_sxs_dir)) |
|
grt (UTC plus 2)
2013/09/12 14:04:53
nit: use braces for multi-line conditional.
gab
2013/09/13 02:02:36
ping on this.
|
| + return true; |
| + } |
| + |
| + return false; |
| } |
| bool InstallUtil::IsChromeSxSProcess() { |