| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/installer/util/self_cleaning_temp_dir.h" | 5 #include "chrome/installer/util/self_cleaning_temp_dir.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 if (base::PathExists(temp_parent_dir)) { | 24 if (base::PathExists(temp_parent_dir)) { |
| 25 // Empty base_dir means that we didn't create any extra directories. | 25 // Empty base_dir means that we didn't create any extra directories. |
| 26 base_dir->clear(); | 26 base_dir->clear(); |
| 27 } else { | 27 } else { |
| 28 base::FilePath parent_dir(temp_parent_dir); | 28 base::FilePath parent_dir(temp_parent_dir); |
| 29 do { | 29 do { |
| 30 *base_dir = parent_dir; | 30 *base_dir = parent_dir; |
| 31 parent_dir = parent_dir.DirName(); | 31 parent_dir = parent_dir.DirName(); |
| 32 } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); | 32 } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); |
| 33 LOG_IF(WARNING, !file_util::DirectoryExists(parent_dir)) | 33 LOG_IF(WARNING, !base::DirectoryExists(parent_dir)) |
| 34 << "A non-directory is at the base of the path leading to a desired " | 34 << "A non-directory is at the base of the path leading to a desired " |
| 35 "temp directory location: " << parent_dir.value(); | 35 "temp directory location: " << parent_dir.value(); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 SelfCleaningTempDir::SelfCleaningTempDir() { | 39 SelfCleaningTempDir::SelfCleaningTempDir() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 SelfCleaningTempDir::~SelfCleaningTempDir() { | 42 SelfCleaningTempDir::~SelfCleaningTempDir() { |
| 43 if (!path().empty() && !Delete()) | 43 if (!path().empty() && !Delete()) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } while (true); | 109 } while (true); |
| 110 } | 110 } |
| 111 | 111 |
| 112 base_dir_.clear(); | 112 base_dir_.clear(); |
| 113 temp_dir_.clear(); | 113 temp_dir_.clear(); |
| 114 | 114 |
| 115 return true; | 115 return true; |
| 116 } | 116 } |
| 117 | 117 |
| 118 } // namespace installer | 118 } // namespace installer |
| OLD | NEW |