summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-10 21:08:12 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-10 21:08:12 +0000
commitc3279126dedc5def022e3b456f1d2c9a9d8d6cdc (patch)
tree1cbba7fe22fb9d29b30be52502ae9ff7ef1cc900 /chrome/installer
parent3e40c8893a8e0061f68a05c483eb2ec047fa0510 (diff)
downloadchromium_src-c3279126dedc5def022e3b456f1d2c9a9d8d6cdc.zip
chromium_src-c3279126dedc5def022e3b456f1d2c9a9d8d6cdc.tar.gz
chromium_src-c3279126dedc5def022e3b456f1d2c9a9d8d6cdc.tar.bz2
Keep a track of which directories are being created when expanding the installation archive.
This is mostly to keep the noise level in the log down (the "directory already exists" entries were over half of the verbose log). TEST=The only change should be that the verbose installer log should be smaller. BUG=none Review URL: http://codereview.chromium.org/6484009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74480 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/util/lzma_util.cc18
-rw-r--r--chrome/installer/util/lzma_util.h10
2 files changed, 24 insertions, 4 deletions
diff --git a/chrome/installer/util/lzma_util.cc b/chrome/installer/util/lzma_util.cc
index b80fdd9..70e899d 100644
--- a/chrome/installer/util/lzma_util.cc
+++ b/chrome/installer/util/lzma_util.cc
@@ -105,8 +105,10 @@ DWORD LzmaUtil::OpenArchive(const std::wstring& archivePath) {
DWORD ret = NO_ERROR;
archive_handle_ = CreateFile(archivePath.c_str(), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (archive_handle_ == INVALID_HANDLE_VALUE)
+ if (archive_handle_ == INVALID_HANDLE_VALUE) {
+ archive_handle_ = NULL; // The rest of the code only checks for NULL.
ret = GetLastError();
+ }
return ret;
}
@@ -164,11 +166,11 @@ DWORD LzmaUtil::UnPack(const std::wstring& location,
// If archive entry is directory create it and move on to the next entry.
if (f->IsDirectory) {
- file_util::CreateDirectory(file_path);
+ CreateDirectory(file_path);
continue;
}
- file_util::CreateDirectory(file_path.DirName());
+ CreateDirectory(file_path.DirName());
HANDLE hFile;
hFile = CreateFile(file_path.value().c_str(), GENERIC_WRITE, 0, NULL,
@@ -215,3 +217,13 @@ void LzmaUtil::CloseArchive() {
archive_handle_ = NULL;
}
}
+
+bool LzmaUtil::CreateDirectory(const FilePath& dir) {
+ bool ret = true;
+ if (directories_created_.find(dir.value()) == directories_created_.end()) {
+ ret = file_util::CreateDirectory(dir);
+ if (ret)
+ directories_created_.insert(dir.value());
+ }
+ return ret;
+}
diff --git a/chrome/installer/util/lzma_util.h b/chrome/installer/util/lzma_util.h
index 765bc19..86523e6 100644
--- a/chrome/installer/util/lzma_util.h
+++ b/chrome/installer/util/lzma_util.h
@@ -6,11 +6,15 @@
#define CHROME_INSTALLER_UTIL_LZMA_UTIL_H_
#pragma once
-#include <string>
#include <windows.h>
+#include <set>
+#include <string>
+
#include "base/basictypes.h"
+class FilePath;
+
// This is a utility class that acts as a wrapper around LZMA SDK library
class LzmaUtil {
public:
@@ -36,8 +40,12 @@ class LzmaUtil {
void CloseArchive();
+ protected:
+ bool CreateDirectory(const FilePath& dir);
+
private:
HANDLE archive_handle_;
+ std::set<std::wstring> directories_created_;
DISALLOW_COPY_AND_ASSIGN(LzmaUtil);
};