| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Strips the filename component from the end of 'path'. | 60 // Strips the filename component from the end of 'path'. |
| 61 void TrimFilename(std::wstring* path); | 61 void TrimFilename(std::wstring* path); |
| 62 | 62 |
| 63 // Returns the filename portion of 'path', without any leading \'s or /'s. | 63 // Returns the filename portion of 'path', without any leading \'s or /'s. |
| 64 std::wstring GetFilenameFromPath(const std::wstring& path); | 64 std::wstring GetFilenameFromPath(const std::wstring& path); |
| 65 | 65 |
| 66 // Returns "jpg" for path "C:\pics\jojo.jpg", or an empty string if | 66 // Returns "jpg" for path "C:\pics\jojo.jpg", or an empty string if |
| 67 // the file has no extension. | 67 // the file has no extension. |
| 68 std::wstring GetFileExtensionFromPath(const std::wstring& path); | 68 std::wstring GetFileExtensionFromPath(const std::wstring& path); |
| 69 | 69 |
| 70 // Returns 'jojo' for path "C:\pics\jojo.jpg". |
| 71 std::wstring GetFilenameWithoutExtensionFromPath(const std::wstring& path); |
| 72 |
| 70 // Returns the directory component of a path, without the trailing | 73 // Returns the directory component of a path, without the trailing |
| 71 // path separator, or an empty string on error. The function does not | 74 // path separator, or an empty string on error. The function does not |
| 72 // check for the existence of the path, so if it is passed a directory | 75 // check for the existence of the path, so if it is passed a directory |
| 73 // without the trailing \, it will interpret the last component of the | 76 // without the trailing \, it will interpret the last component of the |
| 74 // path as a file and chomp it. This does not support relative paths. | 77 // path as a file and chomp it. This does not support relative paths. |
| 75 // Examples: | 78 // Examples: |
| 76 // path == "C:\pics\jojo.jpg", returns "C:\pics" | 79 // path == "C:\pics\jojo.jpg", returns "C:\pics" |
| 77 // path == "C:\Windows\system32\", returns "C:\Windows\system32" | 80 // path == "C:\Windows\system32\", returns "C:\Windows\system32" |
| 78 // path == "C:\Windows\system32", returns "C:\Windows" | 81 // path == "C:\Windows\system32", returns "C:\Windows" |
| 79 std::wstring GetDirectoryFromPath(const std::wstring& path); | 82 std::wstring GetDirectoryFromPath(const std::wstring& path); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 351 |
| 349 // Renames a file using the SHFileOperation API to ensure that the target file | 352 // Renames a file using the SHFileOperation API to ensure that the target file |
| 350 // gets the correct default security descriptor in the new path. | 353 // gets the correct default security descriptor in the new path. |
| 351 bool RenameFileAndResetSecurityDescriptor( | 354 bool RenameFileAndResetSecurityDescriptor( |
| 352 const std::wstring& source_file_path, | 355 const std::wstring& source_file_path, |
| 353 const std::wstring& target_file_path); | 356 const std::wstring& target_file_path); |
| 354 | 357 |
| 355 } // namespace file_util | 358 } // namespace file_util |
| 356 | 359 |
| 357 #endif // BASE_FILE_UTIL_H_ | 360 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |