Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: base/scoped_temp_dir.h

Issue 5340004: Make ScopedTempDir::Delete return a bool so that its functionality can be te... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/scoped_temp_dir.cc » ('j') | base/scoped_temp_dir.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef BASE_SCOPED_TEMP_DIR_H_ 5 #ifndef BASE_SCOPED_TEMP_DIR_H_
6 #define BASE_SCOPED_TEMP_DIR_H_ 6 #define BASE_SCOPED_TEMP_DIR_H_
7 #pragma once 7 #pragma once
8 8
9 // An object representing a temporary / scratch directory that should be cleaned 9 // An object representing a temporary / scratch directory that should be cleaned
10 // up (recursively) when this object goes out of scope. Note that since 10 // up (recursively) when this object goes out of scope. Note that since
(...skipping 20 matching lines...) Expand all
31 bool CreateUniqueTempDir(); 31 bool CreateUniqueTempDir();
32 32
33 // Creates a unique directory under a given path, and takes ownership of it. 33 // Creates a unique directory under a given path, and takes ownership of it.
34 bool CreateUniqueTempDirUnderPath(const FilePath& path); 34 bool CreateUniqueTempDirUnderPath(const FilePath& path);
35 35
36 // Takes ownership of directory at |path|, creating it if necessary. 36 // Takes ownership of directory at |path|, creating it if necessary.
37 // Don't call multiple times unless Take() has been called first. 37 // Don't call multiple times unless Take() has been called first.
38 bool Set(const FilePath& path); 38 bool Set(const FilePath& path);
39 39
40 // Deletes the temporary directory wrapped by this object. 40 // Deletes the temporary directory wrapped by this object.
41 void Delete(); 41 // Returns true if the directory was successfully deleted.
42 // If the current path is empty or if the folder can't be deleted
Paweł Hajdan Jr. 2010/11/26 21:01:20 nit: Don't mention all failure cases. I guess even
43 // for some reason, the return value is false.
44 bool Delete();
Paweł Hajdan Jr. 2010/11/26 21:01:20 nit: Add WARN_UNUSED_RESULT from base/compiler_spe
42 45
43 // 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
44 // when this object goes out of scope. 47 // when this object goes out of scope.
45 FilePath Take(); 48 FilePath Take();
46 49
47 const FilePath& path() const { return path_; } 50 const FilePath& path() const { return path_; }
48 51
49 // Returns true if path_ is non-empty and exists. 52 // Returns true if path_ is non-empty and exists.
50 bool IsValid() const; 53 bool IsValid() const;
51 54
52 private: 55 private:
53 FilePath path_; 56 FilePath path_;
54 57
55 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); 58 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir);
56 }; 59 };
57 60
58 #endif // BASE_SCOPED_TEMP_DIR_H_ 61 #endif // BASE_SCOPED_TEMP_DIR_H_
OLDNEW
« no previous file with comments | « no previous file | base/scoped_temp_dir.cc » ('j') | base/scoped_temp_dir.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698