| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 15 #pragma once |
| 16 | 16 |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 | 18 |
| 19 // We've successfully deprecated all of these functions on non-Windows | 19 // We've successfully deprecated all of these functions on non-Windows |
| 20 // platforms. | 20 // platforms. |
| 21 | 21 |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 | 23 |
| 24 namespace file_util { | 24 namespace file_util { |
| 25 | 25 |
| 26 // Use the FilePath versions instead. | 26 // Use the FilePath versions instead. |
| 27 FILE* OpenFile(const std::string& filename, const char* mode); | 27 FILE* OpenFile(const std::string& filename, const char* mode); |
| 28 FILE* OpenFile(const std::wstring& filename, const char* mode); | 28 FILE* OpenFile(const std::wstring& filename, const char* mode); |
| 29 | 29 |
| 30 // Returns the directory component of a path, without the trailing | |
| 31 // path separator, or an empty string on error. The function does not | |
| 32 // check for the existence of the path, so if it is passed a directory | |
| 33 // without the trailing \, it will interpret the last component of the | |
| 34 // path as a file and chomp it. This does not support relative paths. | |
| 35 // Examples: | |
| 36 // path == "C:\pics\jojo.jpg", returns "C:\pics" | |
| 37 // path == "C:\Windows\system32\", returns "C:\Windows\system32" | |
| 38 // path == "C:\Windows\system32", returns "C:\Windows" | |
| 39 // Deprecated. Use FilePath's DirName() instead. | |
| 40 std::wstring GetDirectoryFromPath(const std::wstring& path); | |
| 41 | |
| 42 // Appends new_ending to path, adding a separator between the two if necessary. | 30 // Appends new_ending to path, adding a separator between the two if necessary. |
| 43 void AppendToPath(std::wstring* path, const std::wstring& new_ending); | 31 void AppendToPath(std::wstring* path, const std::wstring& new_ending); |
| 44 | 32 |
| 45 // Use FilePath::Extension instead. | 33 // Use FilePath::Extension instead. |
| 46 FilePath::StringType GetFileExtensionFromPath(const FilePath& path); | 34 FilePath::StringType GetFileExtensionFromPath(const FilePath& path); |
| 47 std::wstring GetFileExtensionFromPath(const std::wstring& path); | 35 std::wstring GetFileExtensionFromPath(const std::wstring& path); |
| 48 | 36 |
| 49 // Use version that takes a FilePath. | 37 // Use version that takes a FilePath. |
| 50 bool Delete(const std::wstring& path, bool recursive); | 38 bool Delete(const std::wstring& path, bool recursive); |
| 51 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, | 39 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, |
| 52 bool recursive); | 40 bool recursive); |
| 53 int ReadFile(const std::wstring& filename, char* data, int size); | 41 int ReadFile(const std::wstring& filename, char* data, int size); |
| 54 int WriteFile(const std::wstring& filename, const char* data, int size); | 42 int WriteFile(const std::wstring& filename, const char* data, int size); |
| 55 | 43 |
| 56 } | 44 } |
| 57 | 45 |
| 58 #endif // OS_WIN | 46 #endif // OS_WIN |
| 59 | 47 |
| 60 #endif // BASE_FILE_UTIL_DEPRECATED_H_ | 48 #endif // BASE_FILE_UTIL_DEPRECATED_H_ |
| OLD | NEW |