Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: base/file_util.cc

Issue 9484003: Cleanup: Deprecate wstring version of file_util::CopyDirectory(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_deprecated.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <io.h> 8 #include <io.h>
9 #endif 9 #endif
10 #include <stdio.h> 10 #include <stdio.h>
11 11
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 if (!path) { 387 if (!path) {
388 NOTREACHED(); 388 NOTREACHED();
389 return; // Don't crash in this function in release builds. 389 return; // Don't crash in this function in release builds.
390 } 390 }
391 391
392 if (!EndsWithSeparator(FilePath(*path))) 392 if (!EndsWithSeparator(FilePath(*path)))
393 path->push_back(FilePath::kSeparators[0]); 393 path->push_back(FilePath::kSeparators[0]);
394 path->append(new_ending); 394 path->append(new_ending);
395 } 395 }
396 396
397 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
398 bool recursive) {
399 return CopyDirectory(FilePath::FromWStringHack(from_path),
400 FilePath::FromWStringHack(to_path),
401 recursive);
402 }
403 bool Delete(const std::wstring& path, bool recursive) {
404 return Delete(FilePath::FromWStringHack(path), recursive);
405 }
406 std::wstring GetFileExtensionFromPath(const std::wstring& path) {
407 std::wstring file_name = FilePath(path).BaseName().value();
408 const std::wstring::size_type last_dot = file_name.rfind(kExtensionSeparator);
409 return std::wstring(last_dot == std::wstring::npos ? L""
410 : file_name, last_dot + 1);
411 }
412 FILE* OpenFile(const std::wstring& filename, const char* mode) { 397 FILE* OpenFile(const std::wstring& filename, const char* mode) {
413 return OpenFile(FilePath::FromWStringHack(filename), mode); 398 return OpenFile(FilePath::FromWStringHack(filename), mode);
414 } 399 }
415 int ReadFile(const std::wstring& filename, char* data, int size) { 400 int ReadFile(const std::wstring& filename, char* data, int size) {
416 return ReadFile(FilePath::FromWStringHack(filename), data, size); 401 return ReadFile(FilePath::FromWStringHack(filename), data, size);
417 } 402 }
418 int WriteFile(const std::wstring& filename, const char* data, int size) { 403 int WriteFile(const std::wstring& filename, const char* data, int size) {
419 return WriteFile(FilePath::FromWStringHack(filename), data, size); 404 return WriteFile(FilePath::FromWStringHack(filename), data, size);
420 } 405 }
421 #endif // OS_WIN 406 #endif // OS_WIN
422 407
423 /////////////////////////////////////////////// 408 ///////////////////////////////////////////////
424 // FileEnumerator 409 // FileEnumerator
425 // 410 //
426 // Note: the main logic is in file_util_<platform>.cc 411 // Note: the main logic is in file_util_<platform>.cc
427 412
428 bool FileEnumerator::ShouldSkip(const FilePath& path) { 413 bool FileEnumerator::ShouldSkip(const FilePath& path) {
429 FilePath::StringType basename = path.BaseName().value(); 414 FilePath::StringType basename = path.BaseName().value();
430 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); 415 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_));
431 } 416 }
432 417
433 } // namespace 418 } // namespace
OLDNEW
« no previous file with comments | « no previous file | base/file_util_deprecated.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698