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 #ifndef BASE_FILES_SCOPED_TEMP_DIR_H_ | 5 #ifndef BASE_FILES_SCOPED_TEMP_DIR_H_ |
6 #define BASE_FILES_SCOPED_TEMP_DIR_H_ | 6 #define BASE_FILES_SCOPED_TEMP_DIR_H_ |
7 | 7 |
8 // An object representing a temporary / scratch directory that should be cleaned | 8 // An object representing a temporary / scratch directory that should be cleaned |
9 // up (recursively) when this object goes out of scope. Note that since | 9 // up (recursively) when this object goes out of scope. Note that since |
10 // deletion occurs during the destructor, no further error handling is possible | 10 // deletion occurs during the destructor, no further error handling is possible |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Don't call multiple times unless Take() has been called first. | 40 // Don't call multiple times unless Take() has been called first. |
41 bool Set(const FilePath& path) WARN_UNUSED_RESULT; | 41 bool Set(const FilePath& path) WARN_UNUSED_RESULT; |
42 | 42 |
43 // Deletes the temporary directory wrapped by this object. | 43 // Deletes the temporary directory wrapped by this object. |
44 bool Delete() WARN_UNUSED_RESULT; | 44 bool Delete() WARN_UNUSED_RESULT; |
45 | 45 |
46 // Caller takes ownership of the temporary directory so it won't be destroyed | 46 // Caller takes ownership of the temporary directory so it won't be destroyed |
47 // when this object goes out of scope. | 47 // when this object goes out of scope. |
48 FilePath Take(); | 48 FilePath Take(); |
49 | 49 |
| 50 // DEPRECATED: Use GetPath instead. See https://crbug.com/640599 for more |
| 51 // info. |
50 const FilePath& path() const { return path_; } | 52 const FilePath& path() const { return path_; } |
51 | 53 |
| 54 // Returns the path to the created directory. Call one of the |
| 55 // CreateUniqueTempDir* methods before getting the path. |
| 56 const FilePath& GetPath() const; |
| 57 |
52 // Returns true if path_ is non-empty and exists. | 58 // Returns true if path_ is non-empty and exists. |
53 bool IsValid() const; | 59 bool IsValid() const; |
54 | 60 |
55 private: | 61 private: |
56 FilePath path_; | 62 FilePath path_; |
57 | 63 |
58 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); | 64 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); |
59 }; | 65 }; |
60 | 66 |
61 } // namespace base | 67 } // namespace base |
62 | 68 |
63 #endif // BASE_FILES_SCOPED_TEMP_DIR_H_ | 69 #endif // BASE_FILES_SCOPED_TEMP_DIR_H_ |
OLD | NEW |