OLD | NEW |
1 // Copyright (c) 2011 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 |
11 | 11 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 // Sets |real_path| to |path| with symbolic links and junctions expanded. | 318 // Sets |real_path| to |path| with symbolic links and junctions expanded. |
319 // On windows, make sure the path starts with a lettered drive. | 319 // On windows, make sure the path starts with a lettered drive. |
320 // |path| must reference a file. Function will fail if |path| points to | 320 // |path| must reference a file. Function will fail if |path| points to |
321 // a directory or to a nonexistent path. On windows, this function will | 321 // a directory or to a nonexistent path. On windows, this function will |
322 // fail if |path| is a junction or symlink that points to an empty file, | 322 // fail if |path| is a junction or symlink that points to an empty file, |
323 // or if |real_path| would be longer than MAX_PATH characters. | 323 // or if |real_path| would be longer than MAX_PATH characters. |
324 BASE_EXPORT bool NormalizeFilePath(const FilePath& path, FilePath* real_path); | 324 BASE_EXPORT bool NormalizeFilePath(const FilePath& path, FilePath* real_path); |
325 | 325 |
326 #if defined(OS_WIN) | 326 #if defined(OS_WIN) |
327 // Given an existing file in |path|, it returns in |real_path| the path | 327 |
328 // in the native NT format, of the form "\Device\HarddiskVolumeXX\..". | 328 // Given a path in NT native form ("\Device\HarddiskVolumeXX\..."), |
329 // Returns false it it fails. Empty files cannot be resolved with this | 329 // return in |drive_letter_path| the equivalent path that starts with |
330 // function. | 330 // a drive letter ("C:\..."). Return false if no such path exists. |
| 331 BASE_EXPORT bool DevicePathToDriveLetterPath(const FilePath& device_path, |
| 332 FilePath* drive_letter_path); |
| 333 |
| 334 // Given an existing file in |path|, set |real_path| to the path |
| 335 // in native NT format, of the form "\Device\HarddiskVolumeXX\..". |
| 336 // Returns false if the path can not be found. Empty files cannot |
| 337 // be resolved with this function. |
331 BASE_EXPORT bool NormalizeToNativeFilePath(const FilePath& path, | 338 BASE_EXPORT bool NormalizeToNativeFilePath(const FilePath& path, |
332 FilePath* nt_path); | 339 FilePath* nt_path); |
333 #endif | 340 #endif |
334 | 341 |
335 // This function will return if the given file is a symlink or not. | 342 // This function will return if the given file is a symlink or not. |
336 BASE_EXPORT bool IsLink(const FilePath& file_path); | 343 BASE_EXPORT bool IsLink(const FilePath& file_path); |
337 | 344 |
338 // Returns information about the given file path. | 345 // Returns information about the given file path. |
339 BASE_EXPORT bool GetFileInfo(const FilePath& file_path, | 346 BASE_EXPORT bool GetFileInfo(const FilePath& file_path, |
340 base::PlatformFileInfo* info); | 347 base::PlatformFileInfo* info); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 638 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
632 #endif | 639 #endif |
633 | 640 |
634 } // namespace file_util | 641 } // namespace file_util |
635 | 642 |
636 // Deprecated functions have been moved to this separate header file, | 643 // Deprecated functions have been moved to this separate header file, |
637 // which must be included last after all the above definitions. | 644 // which must be included last after all the above definitions. |
638 #include "base/file_util_deprecated.h" | 645 #include "base/file_util_deprecated.h" |
639 | 646 |
640 #endif // BASE_FILE_UTIL_H_ | 647 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |