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

Unified Diff: chrome/installer/util/install_util.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: fix nit 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
« chrome/installer/setup/install.cc ('K') | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/install_util.cc
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 6eb1b66adab2adf30aa3893a603ad17785444798..e7c85e6f1d34b76de75969d436fafca92b03d2dd 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -608,12 +608,16 @@ base::string16 InstallUtil::GetCurrentDate() {
}
// Open |path| with minimal access to obtain information about it, returning
-// true and populating |file| on success.
-// static
+// true and populating |file| on success. If |support_directories| is true,
+// |path| can be a directory.
bool InstallUtil::ProgramCompare::OpenForInfo(const base::FilePath& path,
- base::File* file) {
+ base::File* file,
+ bool support_directories) {
DCHECK(file);
- file->Initialize(path, base::File::FLAG_OPEN);
+ uint32_t flags = base::File::FLAG_OPEN;
+ if (support_directories)
+ flags |= base::File::FLAG_BACKUP_SEMANTICS;
+ file->Initialize(path, flags);
return file->IsValid();
}
@@ -626,10 +630,15 @@ bool InstallUtil::ProgramCompare::GetInfo(const base::File& file,
}
InstallUtil::ProgramCompare::ProgramCompare(const base::FilePath& path_to_match)
+ : ProgramCompare(path_to_match, false) {}
+
+InstallUtil::ProgramCompare::ProgramCompare(const base::FilePath& path_to_match,
+ bool support_directories)
: path_to_match_(path_to_match),
- file_info_() {
+ file_info_(),
+ support_directories_(support_directories) {
DCHECK(!path_to_match_.empty());
- if (!OpenForInfo(path_to_match_, &file_)) {
+ if (!OpenForInfo(path_to_match_, &file_, support_directories_)) {
PLOG(WARNING) << "Failed opening " << path_to_match_.value()
<< "; falling back to path string comparisons.";
} else if (!GetInfo(file_, &file_info_)) {
@@ -673,7 +682,7 @@ bool InstallUtil::ProgramCompare::EvaluatePath(
base::File file;
BY_HANDLE_FILE_INFORMATION info = {};
- return (OpenForInfo(path, &file) &&
+ return (OpenForInfo(path, &file, support_directories_) &&
GetInfo(file, &info) &&
info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber &&
info.nFileIndexHigh == file_info_.nFileIndexHigh &&
« chrome/installer/setup/install.cc ('K') | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698