| 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 // We're trying to transition away from paths as wstrings into using | 5 // We're trying to transition away from paths as wstrings into using |
| 6 // FilePath objects. This file contains declarations of deprecated | 6 // FilePath objects. This file contains declarations of deprecated |
| 7 // functions. By hiding them here rather in the main header, we hope | 7 // functions. By hiding them here rather in the main header, we hope |
| 8 // to discourage callers. | 8 // to discourage callers. |
| 9 | 9 |
| 10 // See file_util.h for documentation on all functions that don't have | 10 // See file_util.h for documentation on all functions that don't have |
| 11 // documentation here. | 11 // documentation here. |
| 12 | 12 |
| 13 #ifndef BASE_FILE_UTIL_DEPRECATED_H_ | 13 #ifndef BASE_FILE_UTIL_DEPRECATED_H_ |
| 14 #define BASE_FILE_UTIL_DEPRECATED_H_ | 14 #define BASE_FILE_UTIL_DEPRECATED_H_ |
| 15 | 15 |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 | 17 |
| 18 namespace file_util { | 18 namespace file_util { |
| 19 | 19 |
| 20 // Use FilePath::DirName instead. | |
| 21 void UpOneDirectory(std::wstring* dir); | |
| 22 // Use FilePath::DirName instead. | |
| 23 void UpOneDirectoryOrEmpty(std::wstring* dir); | |
| 24 | |
| 25 // Use FilePath::BaseName instead. | |
| 26 std::wstring GetFilenameFromPath(const std::wstring& path); | |
| 27 | |
| 28 // Use FilePath::Extension instead. | 20 // Use FilePath::Extension instead. |
| 29 FilePath::StringType GetFileExtensionFromPath(const FilePath& path); | 21 FilePath::StringType GetFileExtensionFromPath(const FilePath& path); |
| 30 std::wstring GetFileExtensionFromPath(const std::wstring& path); | 22 std::wstring GetFileExtensionFromPath(const std::wstring& path); |
| 31 | 23 |
| 32 bool AbsolutePath(std::wstring* path); | 24 bool AbsolutePath(std::wstring* path); |
| 33 | 25 |
| 34 // Use FilePath::InsertBeforeExtension. | 26 // Use FilePath::InsertBeforeExtension. |
| 35 void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix); | 27 void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix); |
| 36 | 28 |
| 37 bool Delete(const std::wstring& path, bool recursive); | 29 bool Delete(const std::wstring& path, bool recursive); |
| 38 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, | 30 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, |
| 39 bool recursive); | 31 bool recursive); |
| 40 bool ReadFileToString(const std::wstring& path, std::string* contents); | 32 bool ReadFileToString(const std::wstring& path, std::string* contents); |
| 41 FILE* OpenFile(const std::string& filename, const char* mode); | 33 FILE* OpenFile(const std::string& filename, const char* mode); |
| 42 FILE* OpenFile(const std::wstring& filename, const char* mode); | 34 FILE* OpenFile(const std::wstring& filename, const char* mode); |
| 43 int ReadFile(const std::wstring& filename, char* data, int size); | 35 int ReadFile(const std::wstring& filename, char* data, int size); |
| 44 int WriteFile(const std::wstring& filename, const char* data, int size); | 36 int WriteFile(const std::wstring& filename, const char* data, int size); |
| 45 | 37 |
| 46 // Functions successfully deprecated on non-Windows, but Win-specific | 38 // Functions successfully deprecated on non-Windows, but Win-specific |
| 47 // callers remain. | 39 // callers remain. |
| 48 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 41 // Use FilePath::DirName instead. |
| 42 void UpOneDirectory(std::wstring* dir); |
| 43 // Use FilePath::DirName instead. |
| 44 void UpOneDirectoryOrEmpty(std::wstring* dir); |
| 45 |
| 46 // Use FilePath::BaseName instead. |
| 47 std::wstring GetFilenameFromPath(const std::wstring& path); |
| 48 |
| 49 // Returns the directory component of a path, without the trailing | 49 // Returns the directory component of a path, without the trailing |
| 50 // path separator, or an empty string on error. The function does not | 50 // path separator, or an empty string on error. The function does not |
| 51 // check for the existence of the path, so if it is passed a directory | 51 // check for the existence of the path, so if it is passed a directory |
| 52 // without the trailing \, it will interpret the last component of the | 52 // without the trailing \, it will interpret the last component of the |
| 53 // path as a file and chomp it. This does not support relative paths. | 53 // path as a file and chomp it. This does not support relative paths. |
| 54 // Examples: | 54 // Examples: |
| 55 // path == "C:\pics\jojo.jpg", returns "C:\pics" | 55 // path == "C:\pics\jojo.jpg", returns "C:\pics" |
| 56 // path == "C:\Windows\system32\", returns "C:\Windows\system32" | 56 // path == "C:\Windows\system32\", returns "C:\Windows\system32" |
| 57 // path == "C:\Windows\system32", returns "C:\Windows" | 57 // path == "C:\Windows\system32", returns "C:\Windows" |
| 58 // Deprecated. Use FilePath's DirName() instead. | 58 // Deprecated. Use FilePath's DirName() instead. |
| 59 std::wstring GetDirectoryFromPath(const std::wstring& path); | 59 std::wstring GetDirectoryFromPath(const std::wstring& path); |
| 60 | 60 |
| 61 // Appends new_ending to path, adding a separator between the two if necessary. | 61 // Appends new_ending to path, adding a separator between the two if necessary. |
| 62 void AppendToPath(std::wstring* path, const std::wstring& new_ending); | 62 void AppendToPath(std::wstring* path, const std::wstring& new_ending); |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 } | 65 } |
| 66 | 66 |
| 67 #endif // BASE_FILE_UTIL_DEPRECATED_H_ | 67 #endif // BASE_FILE_UTIL_DEPRECATED_H_ |
| OLD | NEW |