OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // TODO(erikkay): rename this function and track down all of the callers. | 215 // TODO(erikkay): rename this function and track down all of the callers. |
216 bool CreateTemporaryFileName(std::wstring* temp_file); | 216 bool CreateTemporaryFileName(std::wstring* temp_file); |
217 | 217 |
218 // Create a new directory under TempPath. If prefix is provided, the new | 218 // Create a new directory under TempPath. If prefix is provided, the new |
219 // directory name is in the format of prefixyyyy. | 219 // directory name is in the format of prefixyyyy. |
220 // If success, return true and output the full path of the directory created. | 220 // If success, return true and output the full path of the directory created. |
221 bool CreateNewTempDirectory(const std::wstring& prefix, | 221 bool CreateNewTempDirectory(const std::wstring& prefix, |
222 std::wstring* new_temp_path); | 222 std::wstring* new_temp_path); |
223 | 223 |
224 // Creates a directory, as well as creating any parent directories, if they | 224 // Creates a directory, as well as creating any parent directories, if they |
225 // don't exist. Returns 'true' on successful creation. | 225 // don't exist. Returns 'true' on successful creation, or if the directory |
| 226 // already exists. |
226 bool CreateDirectory(const std::wstring& full_path); | 227 bool CreateDirectory(const std::wstring& full_path); |
227 | 228 |
228 // Returns the file size. Returns true on success. | 229 // Returns the file size. Returns true on success. |
229 bool GetFileSize(const std::wstring& file_path, int64* file_size); | 230 bool GetFileSize(const std::wstring& file_path, int64* file_size); |
230 | 231 |
231 // Reads the given number of bytes from the file into the buffer. Returns | 232 // Reads the given number of bytes from the file into the buffer. Returns |
232 // the number of read bytes, or -1 on error. | 233 // the number of read bytes, or -1 on error. |
233 int ReadFile(const std::wstring& filename, char* data, int size); | 234 int ReadFile(const std::wstring& filename, char* data, int size); |
234 | 235 |
235 // Writes the given buffer into the file, overwriting any data that was | 236 // Writes the given buffer into the file, overwriting any data that was |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 314 |
314 // Renames a file using the MoveFileEx API and ensures that the target file gets | 315 // Renames a file using the MoveFileEx API and ensures that the target file gets |
315 // the correct security descriptor in the new path. | 316 // the correct security descriptor in the new path. |
316 bool RenameFileAndResetSecurityDescriptor( | 317 bool RenameFileAndResetSecurityDescriptor( |
317 const std::wstring& source_file_path, | 318 const std::wstring& source_file_path, |
318 const std::wstring& target_file_path); | 319 const std::wstring& target_file_path); |
319 | 320 |
320 } // namespace file_util | 321 } // namespace file_util |
321 | 322 |
322 #endif // BASE_FILE_UTIL_H_ | 323 #endif // BASE_FILE_UTIL_H_ |
323 | |
OLD | NEW |