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..70678af80e91671ecfc999806a0e25e1b65ecef7 100644 |
| --- a/chrome/installer/util/install_util.cc |
| +++ b/chrome/installer/util/install_util.cc |
| @@ -365,10 +365,28 @@ 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> ComponentsType; |
|
gab
2013/09/10 19:08:57
I don't feel this typedef is necessary; it adds co
zturner
2013/09/11 20:19:53
Well, it's just that
std::vector<base::FilePath:
grt (UTC plus 2)
2013/09/11 20:41:52
I like the typedef, although I don't like "Type" i
gab
2013/09/11 20:53:49
Well, one of the 2 places is the line just below t
|
| + ComponentsType components; |
| + exe_dir.GetComponents(&components); |
| + ComponentsType::const_reverse_iterator iter = components.rbegin(); |
| + while (iter != components.rend()) { |
| + auto next = iter+1; |
|
gab
2013/09/10 19:08:57
I still think you can't use "auto" in Chromium (re
zturner
2013/09/11 20:19:53
You're right, I just missed this one.
|
| + |
| + if (base::FilePath::CompareEqualIgnoreCase(*iter, |
| + installer::kInstallBinaryDir)) { |
| + |
| + if (next != components.rend() && |
|
gab
2013/09/10 19:08:57
Use "&&" to continue previous condition instead of
|
| + (base::FilePath::CompareEqualIgnoreCase(*next, chrome_sxs_dir))) |
| + return true; |
| + } |
| + |
| + iter = next; |
|
gab
2013/09/10 19:08:57
Feels like a for loop to me;
e.g.,:
for (Compone
zturner
2013/09/11 20:19:53
Yea, but then if I don't use the typedef it looks
|
| + } |
| + |
| + return false; |
| } |
| bool InstallUtil::IsChromeSxSProcess() { |