OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 // Returns the file size. Returns true on success. | 275 // Returns the file size. Returns true on success. |
276 bool GetFileSize(const FilePath& file_path, int64* file_size); | 276 bool GetFileSize(const FilePath& file_path, int64* file_size); |
277 | 277 |
278 // Returns true if the given path's base name is ".". | 278 // Returns true if the given path's base name is ".". |
279 bool IsDot(const FilePath& path); | 279 bool IsDot(const FilePath& path); |
280 | 280 |
281 // Returns true if the given path's base name is "..". | 281 // Returns true if the given path's base name is "..". |
282 bool IsDotDot(const FilePath& path); | 282 bool IsDotDot(const FilePath& path); |
283 | 283 |
284 #if defined(OS_POSIX) | 284 // Sets |real_path| to |path| with symbolic links and junctions expanded. |
285 // Set |real_path| to |path| with symbolic links expanded. | 285 // On windows, make sure the path starts with a lettered drive. |
286 // Windows support (expanding junctions) comming soon: | 286 // |path| must reference a file. Function will fail if |path| points to |
287 // http://crbug.com/13044 | 287 // a directory or to a nonexistent path. On windows, this function will |
288 bool RealPath(const FilePath& path, FilePath* real_path); | 288 // fail if |path| is a junction or symlink that points to an empty file, |
289 #endif | 289 // or if |real_path| would be longer than MAX_PATH characters. |
| 290 bool NormalizeFilePath(const FilePath& path, FilePath* real_path); |
290 | 291 |
291 // Used to hold information about a given file path. See GetFileInfo below. | 292 // Used to hold information about a given file path. See GetFileInfo below. |
292 struct FileInfo { | 293 struct FileInfo { |
293 // The size of the file in bytes. Undefined when is_directory is true. | 294 // The size of the file in bytes. Undefined when is_directory is true. |
294 int64 size; | 295 int64 size; |
295 | 296 |
296 // True if the file corresponds to a directory. | 297 // True if the file corresponds to a directory. |
297 bool is_directory; | 298 bool is_directory; |
298 | 299 |
299 // The last modified time of a file. | 300 // The last modified time of a file. |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 579 |
579 #endif // UNIT_TEST | 580 #endif // UNIT_TEST |
580 | 581 |
581 } // namespace file_util | 582 } // namespace file_util |
582 | 583 |
583 // Deprecated functions have been moved to this separate header file, | 584 // Deprecated functions have been moved to this separate header file, |
584 // which must be included last after all the above definitions. | 585 // which must be included last after all the above definitions. |
585 #include "base/file_util_deprecated.h" | 586 #include "base/file_util_deprecated.h" |
586 | 587 |
587 #endif // BASE_FILE_UTIL_H_ | 588 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |