summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-11 20:59:02 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-11 20:59:02 +0000
commit37b3c199da23208121a946491ce749bafeb573c2 (patch)
tree1f12a473162863cd3c2507f08f53ec910e2da57d /base/file_util_win.cc
parentce4ac5324890624e6688f7bb732a4c7ab701c2b4 (diff)
downloadchromium_src-37b3c199da23208121a946491ce749bafeb573c2.zip
chromium_src-37b3c199da23208121a946491ce749bafeb573c2.tar.gz
chromium_src-37b3c199da23208121a946491ce749bafeb573c2.tar.bz2
Move AppendFile and *CurrentDirectory to the base namespace.
This moves AppendFile, GetCurrentDirectory, and SetCurrentDirectory to the base namespace. TBR=jam Review URL: https://codereview.chromium.org/177923007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc43
1 files changed, 22 insertions, 21 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 58e02dc..5350b34 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -631,23 +631,8 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
return -1;
}
-} // namespace base
-
-// -----------------------------------------------------------------------------
-
-namespace file_util {
-
-using base::DirectoryExists;
-using base::FilePath;
-using base::kFileShareAll;
-
-FILE* OpenFile(const std::string& filename, const char* mode) {
- base::ThreadRestrictions::AssertIOAllowed();
- return _fsopen(filename.c_str(), mode, _SH_DENYNO);
-}
-
int AppendToFile(const FilePath& filename, const char* data, int size) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
base::win::ScopedHandle file(CreateFile(filename.value().c_str(),
FILE_APPEND_DATA,
0,
@@ -657,7 +642,7 @@ int AppendToFile(const FilePath& filename, const char* data, int size) {
NULL));
if (!file) {
DLOG_GETLASTERROR(WARNING) << "CreateFile failed for path "
- << filename.value();
+ << UTF16ToUTF8(filename.value());
return -1;
}
@@ -668,19 +653,20 @@ int AppendToFile(const FilePath& filename, const char* data, int size) {
if (!result) {
// WriteFile failed.
- DLOG_GETLASTERROR(WARNING) << "writing file " << filename.value()
+ DLOG_GETLASTERROR(WARNING) << "writing file "
+ << UTF16ToUTF8(filename.value())
<< " failed";
} else {
// Didn't write all the bytes.
DLOG(WARNING) << "wrote" << written << " bytes to "
- << filename.value() << " expected " << size;
+ << UTF16ToUTF8(filename.value()) << " expected " << size;
}
return -1;
}
// Gets the current working directory for the process.
bool GetCurrentDirectory(FilePath* dir) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
wchar_t system_buffer[MAX_PATH];
system_buffer[0] = 0;
@@ -697,11 +683,26 @@ bool GetCurrentDirectory(FilePath* dir) {
// Sets the current working directory for the process.
bool SetCurrentDirectory(const FilePath& directory) {
- base::ThreadRestrictions::AssertIOAllowed();
+ ThreadRestrictions::AssertIOAllowed();
BOOL ret = ::SetCurrentDirectory(directory.value().c_str());
return ret != 0;
}
+} // namespace base
+
+// -----------------------------------------------------------------------------
+
+namespace file_util {
+
+using base::DirectoryExists;
+using base::FilePath;
+using base::kFileShareAll;
+
+FILE* OpenFile(const std::string& filename, const char* mode) {
+ base::ThreadRestrictions::AssertIOAllowed();
+ return _fsopen(filename.c_str(), mode, _SH_DENYNO);
+}
+
int GetMaximumPathComponentLength(const FilePath& path) {
base::ThreadRestrictions::AssertIOAllowed();