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

Side by Side Diff: base/file_util.h

Issue 10690047: Fix a bug in file_util::Delete() where symlinks are not handled right (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync & add comment Created 8 years, 5 months 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/file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file contains utility functions for dealing with the local 5 // This file contains utility functions for dealing with the local
6 // filesystem. 6 // filesystem.
7 7
8 #ifndef BASE_FILE_UTIL_H_ 8 #ifndef BASE_FILE_UTIL_H_
9 #define BASE_FILE_UTIL_H_ 9 #define BASE_FILE_UTIL_H_
10 #pragma once 10 #pragma once
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // particularly speedy in any platform. 93 // particularly speedy in any platform.
94 BASE_EXPORT int64 ComputeFilesSize(const FilePath& directory, 94 BASE_EXPORT int64 ComputeFilesSize(const FilePath& directory,
95 const FilePath::StringType& pattern); 95 const FilePath::StringType& pattern);
96 96
97 // Deletes the given path, whether it's a file or a directory. 97 // Deletes the given path, whether it's a file or a directory.
98 // If it's a directory, it's perfectly happy to delete all of the 98 // If it's a directory, it's perfectly happy to delete all of the
99 // directory's contents. Passing true to recursive deletes 99 // directory's contents. Passing true to recursive deletes
100 // subdirectories and their contents as well. 100 // subdirectories and their contents as well.
101 // Returns true if successful, false otherwise. 101 // Returns true if successful, false otherwise.
102 // 102 //
103 // In posix environment and if |path| is a symbolic link, this deletes only
104 // the symlink. (even if the symlink deferences to a non-existent file)
105 //
103 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT 106 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT
104 // TO "rm -rf", SO USE WITH CAUTION. 107 // TO "rm -rf", SO USE WITH CAUTION.
105 BASE_EXPORT bool Delete(const FilePath& path, bool recursive); 108 BASE_EXPORT bool Delete(const FilePath& path, bool recursive);
106 109
107 #if defined(OS_WIN) 110 #if defined(OS_WIN)
108 // Schedules to delete the given path, whether it's a file or a directory, until 111 // Schedules to delete the given path, whether it's a file or a directory, until
109 // the operating system is restarted. 112 // the operating system is restarted.
110 // Note: 113 // Note:
111 // 1) The file/directory to be deleted should exist in a temp folder. 114 // 1) The file/directory to be deleted should exist in a temp folder.
112 // 2) The directory to be deleted must be empty. 115 // 2) The directory to be deleted must be empty.
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 }; 636 };
634 637
635 // Attempts determine the FileSystemType for |path|. 638 // Attempts determine the FileSystemType for |path|.
636 // Returns false if |path| doesn't exist. 639 // Returns false if |path| doesn't exist.
637 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); 640 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type);
638 #endif 641 #endif
639 642
640 } // namespace file_util 643 } // namespace file_util
641 644
642 #endif // BASE_FILE_UTIL_H_ 645 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698