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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 std::wstring* new_temp_path); | 260 std::wstring* new_temp_path); |
261 | 261 |
262 // Creates a directory, as well as creating any parent directories, if they | 262 // Creates a directory, as well as creating any parent directories, if they |
263 // don't exist. Returns 'true' on successful creation, or if the directory | 263 // don't exist. Returns 'true' on successful creation, or if the directory |
264 // already exists. | 264 // already exists. |
265 bool CreateDirectory(const FilePath& full_path); | 265 bool CreateDirectory(const FilePath& full_path); |
266 // Deprecated temporary compatibility function. | 266 // Deprecated temporary compatibility function. |
267 bool CreateDirectory(const std::wstring& full_path); | 267 bool CreateDirectory(const std::wstring& full_path); |
268 | 268 |
269 // Returns the file size. Returns true on success. | 269 // Returns the file size. Returns true on success. |
| 270 bool GetFileSize(const FilePath& file_path, int64* file_size); |
| 271 // Deprecated temporary compatibility function. |
270 bool GetFileSize(const std::wstring& file_path, int64* file_size); | 272 bool GetFileSize(const std::wstring& file_path, int64* file_size); |
271 | 273 |
272 // Used to hold information about a given file path. See GetFileInfo below. | 274 // Used to hold information about a given file path. See GetFileInfo below. |
273 struct FileInfo { | 275 struct FileInfo { |
274 // The size of the file in bytes. Undefined when is_directory is true. | 276 // The size of the file in bytes. Undefined when is_directory is true. |
275 int64 size; | 277 int64 size; |
276 | 278 |
277 // True if the file corresponds to a directory. | 279 // True if the file corresponds to a directory. |
278 bool is_directory; | 280 bool is_directory; |
279 | 281 |
280 // Add additional fields here as needed. | 282 // Add additional fields here as needed. |
281 }; | 283 }; |
282 | 284 |
283 // Returns information about the given file path. | 285 // Returns information about the given file path. |
| 286 bool GetFileInfo(const FilePath& file_path, FileInfo* info); |
| 287 // Deprecated temporary compatibility function. |
284 bool GetFileInfo(const std::wstring& file_path, FileInfo* info); | 288 bool GetFileInfo(const std::wstring& file_path, FileInfo* info); |
285 | 289 |
| 290 |
286 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 291 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
287 FILE* OpenFile(const FilePath& filename, const char* mode); | 292 FILE* OpenFile(const FilePath& filename, const char* mode); |
288 // Deprecated temporary compatibility functions. | 293 // Deprecated temporary compatibility functions. |
289 FILE* OpenFile(const std::string& filename, const char* mode); | 294 FILE* OpenFile(const std::string& filename, const char* mode); |
290 FILE* OpenFile(const std::wstring& filename, const char* mode); | 295 FILE* OpenFile(const std::wstring& filename, const char* mode); |
291 | 296 |
292 // Closes file opened by OpenFile. Returns true on success. | 297 // Closes file opened by OpenFile. Returns true on success. |
293 bool CloseFile(FILE* file); | 298 bool CloseFile(FILE* file); |
294 | 299 |
295 // Reads the given number of bytes from the file into the buffer. Returns | 300 // Reads the given number of bytes from the file into the buffer. Returns |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 384 |
380 // Renames a file using the SHFileOperation API to ensure that the target file | 385 // Renames a file using the SHFileOperation API to ensure that the target file |
381 // gets the correct default security descriptor in the new path. | 386 // gets the correct default security descriptor in the new path. |
382 bool RenameFileAndResetSecurityDescriptor( | 387 bool RenameFileAndResetSecurityDescriptor( |
383 const std::wstring& source_file_path, | 388 const std::wstring& source_file_path, |
384 const std::wstring& target_file_path); | 389 const std::wstring& target_file_path); |
385 | 390 |
386 } // namespace file_util | 391 } // namespace file_util |
387 | 392 |
388 #endif // BASE_FILE_UTIL_H_ | 393 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |