| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 #endif // defined(OS_WIN) | 205 #endif // defined(OS_WIN) |
| 206 | 206 |
| 207 // Returns true if the contents of the two files given are equal, false | 207 // Returns true if the contents of the two files given are equal, false |
| 208 // otherwise. If either file can't be read, returns false. | 208 // otherwise. If either file can't be read, returns false. |
| 209 bool ContentsEqual(const FilePath& filename1, | 209 bool ContentsEqual(const FilePath& filename1, |
| 210 const FilePath& filename2); | 210 const FilePath& filename2); |
| 211 // Deprecated temporary compatibility function. | 211 // Deprecated temporary compatibility function. |
| 212 bool ContentsEqual(const std::wstring& filename1, | 212 bool ContentsEqual(const std::wstring& filename1, |
| 213 const std::wstring& filename2); | 213 const std::wstring& filename2); |
| 214 | 214 |
| 215 // Returns true if the contents of the two text files given are equal, false |
| 216 // otherwise. This routine treats "\r\n" and "\n" as equivalent. |
| 217 bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2); |
| 218 |
| 215 // Read the file at |path| into |contents|, returning true on success. | 219 // Read the file at |path| into |contents|, returning true on success. |
| 216 // Useful for unit tests. | 220 // Useful for unit tests. |
| 217 bool ReadFileToString(const FilePath& path, std::string* contents); | 221 bool ReadFileToString(const FilePath& path, std::string* contents); |
| 218 // Deprecated version. | 222 // Deprecated version. |
| 219 bool ReadFileToString(const std::wstring& path, std::string* contents); | 223 bool ReadFileToString(const std::wstring& path, std::string* contents); |
| 220 | 224 |
| 221 #if defined(OS_POSIX) | 225 #if defined(OS_POSIX) |
| 222 // Read exactly |bytes| bytes from file descriptor |fd|, storing the result | 226 // Read exactly |bytes| bytes from file descriptor |fd|, storing the result |
| 223 // in |buffer|. This function is protected against EINTR and partial reads. | 227 // in |buffer|. This function is protected against EINTR and partial reads. |
| 224 // Returns true iff |bytes| bytes have been successfuly read from |fd|. | 228 // Returns true iff |bytes| bytes have been successfuly read from |fd|. |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 530 |
| 527 // Renames a file using the SHFileOperation API to ensure that the target file | 531 // Renames a file using the SHFileOperation API to ensure that the target file |
| 528 // gets the correct default security descriptor in the new path. | 532 // gets the correct default security descriptor in the new path. |
| 529 bool RenameFileAndResetSecurityDescriptor( | 533 bool RenameFileAndResetSecurityDescriptor( |
| 530 const FilePath& source_file_path, | 534 const FilePath& source_file_path, |
| 531 const FilePath& target_file_path); | 535 const FilePath& target_file_path); |
| 532 | 536 |
| 533 } // namespace file_util | 537 } // namespace file_util |
| 534 | 538 |
| 535 #endif // BASE_FILE_UTIL_H_ | 539 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |