| Index: base/file_util.cc
|
| diff --git a/base/file_util.cc b/base/file_util.cc
|
| index 49f063ead22c4b9c6fa42d86caaa926c485c9c63..e196ff8c122531b2d3cff5a7ee9d918d57f14b8c 100644
|
| --- a/base/file_util.cc
|
| +++ b/base/file_util.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include <fstream>
|
|
|
| +#include "base/file_path.h"
|
| #include "base/logging.h"
|
| #include "base/string_util.h"
|
| #include "unicode/uniset.h"
|
| @@ -229,20 +230,14 @@ void ReplaceExtension(std::wstring* file_name, const std::wstring& extension) {
|
| file_name->swap(result);
|
| }
|
|
|
| -bool ContentsEqual(const std::wstring& filename1,
|
| - const std::wstring& filename2) {
|
| +bool ContentsEqual(const FilePath& filename1, const FilePath& filename2) {
|
| // We open the file in binary format even if they are text files because
|
| // we are just comparing that bytes are exactly same in both files and not
|
| // doing anything smart with text formatting.
|
| -#if defined(OS_WIN)
|
| - std::ifstream file1(filename1.c_str(), std::ios::in | std::ios::binary);
|
| - std::ifstream file2(filename2.c_str(), std::ios::in | std::ios::binary);
|
| -#elif defined(OS_POSIX)
|
| - std::ifstream file1(WideToUTF8(filename1).c_str(),
|
| + std::ifstream file1(filename1.value().c_str(),
|
| std::ios::in | std::ios::binary);
|
| - std::ifstream file2(WideToUTF8(filename2).c_str(),
|
| + std::ifstream file2(filename2.value().c_str(),
|
| std::ios::in | std::ios::binary);
|
| -#endif
|
|
|
| // Even if both files aren't openable (and thus, in some sense, "equal"),
|
| // any unusable file yields a result of "false".
|
| @@ -300,5 +295,60 @@ bool CloseFile(FILE* file) {
|
| return fclose(file) == 0;
|
| }
|
|
|
| +// Deprecated functions ----------------------------------------------------
|
| +
|
| +bool AbsolutePath(std::wstring* path_str) {
|
| + FilePath path;
|
| + if (!AbsolutePath(&path))
|
| + return false;
|
| + *path_str = path.ToWStringHack();
|
| + return true;
|
| +}
|
| +bool Delete(const std::wstring& path, bool recursive) {
|
| + return Delete(FilePath::FromWStringHack(path), recursive);
|
| +}
|
| +bool Move(const std::wstring& from_path, const std::wstring& to_path) {
|
| + return Move(FilePath::FromWStringHack(from_path),
|
| + FilePath::FromWStringHack(to_path));
|
| +}
|
| +bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) {
|
| + return CopyFile(FilePath::FromWStringHack(from_path),
|
| + FilePath::FromWStringHack(to_path));
|
| +}
|
| +bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
|
| + bool recursive) {
|
| + return CopyDirectory(FilePath::FromWStringHack(from_path),
|
| + FilePath::FromWStringHack(to_path),
|
| + recursive);
|
| +}
|
| +bool PathExists(const std::wstring& path) {
|
| + return PathExists(FilePath::FromWStringHack(path));
|
| +}
|
| +bool DirectoryExists(const std::wstring& path) {
|
| + return DirectoryExists(FilePath::FromWStringHack(path));
|
| +}
|
| +bool ContentsEqual(const std::wstring& filename1,
|
| + const std::wstring& filename2) {
|
| + return ContentsEqual(FilePath::FromWStringHack(filename1),
|
| + FilePath::FromWStringHack(filename2));
|
| +}
|
| +bool CreateDirectory(const std::wstring& full_path) {
|
| + return CreateDirectory(FilePath::FromWStringHack(full_path));
|
| +}
|
| +bool GetCurrentDirectory(std::wstring* path_str) {
|
| + FilePath path;
|
| + if (!GetCurrentDirectory(&path))
|
| + return false;
|
| + *path_str = path.ToWStringHack();
|
| + return true;
|
| +}
|
| +bool GetTempDir(std::wstring* path_str) {
|
| + FilePath path;
|
| + if (!GetTempDir(&path))
|
| + return false;
|
| + *path_str = path.ToWStringHack();
|
| + return true;
|
| +}
|
| +
|
| } // namespace
|
|
|
|
|