If CreateDirectory() fails during extension unpacking, log the exact OS call that failed.
This change is designed to help understand bug 35198, which we can not reproduce locally.
BUG=35198
TEST=manual
Review URL: http://codereview.chromium.org/2714016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49703 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc
index 8c634e2..599aa11 100644
--- a/chrome/common/extensions/extension_unpacker.cc
+++ b/chrome/common/extensions/extension_unpacker.cc
@@ -140,15 +140,23 @@
// <profile>/Extensions/INSTALL_TEMP/<version>
temp_install_dir_ =
extension_path_.DirName().AppendASCII(filenames::kTempExtensionName);
- if (!file_util::CreateDirectory(temp_install_dir_)) {
+
#if defined(OS_WIN)
- std::string dir_string = WideToUTF8(temp_install_dir_.value());
+ std::ostringstream log_stream;
+ std::string dir_string = WideToUTF8(temp_install_dir_.value());
+ log_stream << kCouldNotCreateDirectoryError << dir_string << std::endl;
+ if (!file_util::CreateDirectoryExtraLogging(temp_install_dir_, log_stream)) {
+ log_stream.flush();
+ SetError(log_stream.str());
+ return false;
+ }
#else
+ if (!file_util::CreateDirectory(temp_install_dir_)) {
std::string dir_string = temp_install_dir_.value();
-#endif
SetError(kCouldNotCreateDirectoryError + dir_string);
return false;
}
+#endif
if (!Unzip(extension_path_, temp_install_dir_)) {
SetError(kCouldNotUnzipExtension);