Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Unified Diff: chrome/installer/setup/install.cc

Issue 1800303006: Fix the path of shortcuts with an icon in the current install dir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/setup/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 744af926972ec5fa5d07687713591f568cb17cd1..1e4a2c0e76a895748e83773d54f22723157f1e46 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -282,14 +282,24 @@ void UpdatePerUserShortcutsInLocation(
base::FileEnumerator::FILES);
for (base::FilePath shortcut = shortcuts_enum.Next(); !shortcut.empty();
shortcut = shortcuts_enum.Next()) {
- base::FilePath existing_target_path;
- if (!base::win::ResolveShortcut(shortcut, &existing_target_path, nullptr) ||
- !base::StartsWith(existing_target_path.value(),
- old_target_dir.AsEndingWithSeparator().value(),
- base::CompareCase::INSENSITIVE_ASCII) ||
- !base::EndsWith(existing_target_path.value(),
- old_target_path_suffix.value(),
- base::CompareCase::INSENSITIVE_ASCII)) {
+ base::win::ShortcutProperties shortcut_properties;
+ if (!base::win::ResolveShortcutProperties(
+ shortcut, (base::win::ShortcutProperties::PROPERTIES_TARGET |
+ base::win::ShortcutProperties::PROPERTIES_ICON),
+ &shortcut_properties)) {
+ continue;
+ }
+
+ // TODO(fdoray): Stop using the icon to identify shortcuts that need to be
+ // updated in May 2016. This is just intended to fix shortcuts broken by
+ // crbug.com/595374.
+ if (!(base::StartsWith(shortcut_properties.target.value(),
+ old_target_dir.AsEndingWithSeparator().value(),
+ base::CompareCase::INSENSITIVE_ASCII) &&
+ base::EndsWith(shortcut_properties.target.value(),
+ old_target_path_suffix.value(),
+ base::CompareCase::INSENSITIVE_ASCII)) &&
+ !old_target_dir.IsParent(shortcut_properties.icon)) {
gab 2016/03/17 20:14:23 I had a hard time reading this logic, I'd say add
gab 2016/03/17 20:14:23 How about we do path comparison everywhere instead
fdoray 2016/03/18 14:08:59 Done.
fdoray 2016/03/18 14:08:59 Done.
continue;
}
« no previous file with comments | « no previous file | chrome/installer/setup/install_unittest.cc » ('j') | chrome/installer/setup/install_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698