OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/scoped_temp_dir.h" | 5 #include "base/scoped_temp_dir.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | |
10 | 9 |
11 ScopedTempDir::ScopedTempDir() { | 10 ScopedTempDir::ScopedTempDir() { |
12 } | 11 } |
13 | 12 |
14 ScopedTempDir::~ScopedTempDir() { | 13 ScopedTempDir::~ScopedTempDir() { |
15 if (!path_.empty() && !file_util::Delete(path_, true)) | 14 if (!path_.empty() && !file_util::Delete(path_, true)) |
16 LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value(); | 15 LOG(ERROR) << "ScopedTempDir unable to delete " << path_.value(); |
17 } | 16 } |
18 | 17 |
19 bool ScopedTempDir::CreateUniqueTempDir() { | 18 bool ScopedTempDir::CreateUniqueTempDir() { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 52 |
54 FilePath ScopedTempDir::Take() { | 53 FilePath ScopedTempDir::Take() { |
55 FilePath ret = path_; | 54 FilePath ret = path_; |
56 path_ = FilePath(); | 55 path_ = FilePath(); |
57 return ret; | 56 return ret; |
58 } | 57 } |
59 | 58 |
60 bool ScopedTempDir::IsValid() const { | 59 bool ScopedTempDir::IsValid() const { |
61 return !path_.empty() && file_util::DirectoryExists(path_); | 60 return !path_.empty() && file_util::DirectoryExists(path_); |
62 } | 61 } |
OLD | NEW |