FilePath: Remove much of ToWStringHack, adding a LossyDisplayName()
The reason we don't want a free conversion between FilePaths and Unicode
is that it can be lossy. But when displaying a string to the user,
we're ok if it's lossy when we have no other option.
This change introduces a LossyDisplayName() method that returns a
string16, and converts many of the users of ToWStringHack to use it.
BUG=69467
Review URL: http://codereview.chromium.org/6246036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73840 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 8a205c0f534bf8e5f17a531182dee38aaacd46e6
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 6ea94e4..ea29df5 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -163,7 +163,7 @@
void CreateTextFile(const FilePath& filename,
const std::wstring& contents) {
std::ofstream file;
- file.open(WideToUTF8(filename.ToWStringHack()).c_str());
+ file.open(filename.value().c_str());
ASSERT_TRUE(file.is_open());
file << contents;
file.close();
@@ -173,7 +173,7 @@
std::wstring ReadTextFile(const FilePath& filename) {
wchar_t contents[64];
std::wifstream file;
- file.open(WideToUTF8(filename.ToWStringHack()).c_str());
+ file.open(filename.value().c_str());
EXPECT_TRUE(file.is_open());
file.getline(contents, 64);
file.close();