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

Side by Side Diff: base/file_util.cc

Issue 280004: Revert wstring patch (r29078 and follow up commits). It is causing failures o... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 | « base/file_util.h ('k') | chrome/browser/first_run_win.cc » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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>
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 bool recursive) { 315 bool recursive) {
316 return CopyDirectory(FilePath::FromWStringHack(from_path), 316 return CopyDirectory(FilePath::FromWStringHack(from_path),
317 FilePath::FromWStringHack(to_path), 317 FilePath::FromWStringHack(to_path),
318 recursive); 318 recursive);
319 } 319 }
320 bool ContentsEqual(const std::wstring& filename1, 320 bool ContentsEqual(const std::wstring& filename1,
321 const std::wstring& filename2) { 321 const std::wstring& filename2) {
322 return ContentsEqual(FilePath::FromWStringHack(filename1), 322 return ContentsEqual(FilePath::FromWStringHack(filename1),
323 FilePath::FromWStringHack(filename2)); 323 FilePath::FromWStringHack(filename2));
324 } 324 }
325 bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) {
326 return CopyFile(FilePath::FromWStringHack(from_path),
327 FilePath::FromWStringHack(to_path));
328 }
325 bool CreateDirectory(const std::wstring& full_path) { 329 bool CreateDirectory(const std::wstring& full_path) {
326 return CreateDirectory(FilePath::FromWStringHack(full_path)); 330 return CreateDirectory(FilePath::FromWStringHack(full_path));
327 } 331 }
328 bool CreateNewTempDirectory(const std::wstring& prefix, 332 bool CreateNewTempDirectory(const std::wstring& prefix,
329 std::wstring* new_temp_path) { 333 std::wstring* new_temp_path) {
330 #if defined(OS_WIN) 334 #if defined(OS_WIN)
331 FilePath::StringType dir_prefix(prefix); 335 FilePath::StringType dir_prefix(prefix);
332 #elif defined(OS_POSIX) 336 #elif defined(OS_POSIX)
333 FilePath::StringType dir_prefix = WideToUTF8(prefix); 337 FilePath::StringType dir_prefix = WideToUTF8(prefix);
334 #endif 338 #endif
335 FilePath temp_path; 339 FilePath temp_path;
336 if (!CreateNewTempDirectory(dir_prefix, &temp_path)) 340 if (!CreateNewTempDirectory(dir_prefix, &temp_path))
337 return false; 341 return false;
338 *new_temp_path = temp_path.ToWStringHack(); 342 *new_temp_path = temp_path.ToWStringHack();
339 return true; 343 return true;
340 } 344 }
341 bool Delete(const std::wstring& path, bool recursive) { 345 bool Delete(const std::wstring& path, bool recursive) {
342 return Delete(FilePath::FromWStringHack(path), recursive); 346 return Delete(FilePath::FromWStringHack(path), recursive);
343 } 347 }
348 bool DirectoryExists(const std::wstring& path) {
349 return DirectoryExists(FilePath::FromWStringHack(path));
350 }
344 bool EndsWithSeparator(std::wstring* path) { 351 bool EndsWithSeparator(std::wstring* path) {
345 return EndsWithSeparator(FilePath::FromWStringHack(*path)); 352 return EndsWithSeparator(FilePath::FromWStringHack(*path));
346 } 353 }
347 bool EndsWithSeparator(const std::wstring& path) { 354 bool EndsWithSeparator(const std::wstring& path) {
348 return EndsWithSeparator(FilePath::FromWStringHack(path)); 355 return EndsWithSeparator(FilePath::FromWStringHack(path));
349 } 356 }
350 bool GetCurrentDirectory(std::wstring* path_str) { 357 bool GetCurrentDirectory(std::wstring* path_str) {
351 FilePath path; 358 FilePath path;
352 if (!GetCurrentDirectory(&path)) 359 if (!GetCurrentDirectory(&path))
353 return false; 360 return false;
(...skipping 21 matching lines...) Expand all
375 bool GetFileSize(const std::wstring& file_path, int64* file_size) { 382 bool GetFileSize(const std::wstring& file_path, int64* file_size) {
376 return GetFileSize(FilePath::FromWStringHack(file_path), file_size); 383 return GetFileSize(FilePath::FromWStringHack(file_path), file_size);
377 } 384 }
378 bool GetTempDir(std::wstring* path_str) { 385 bool GetTempDir(std::wstring* path_str) {
379 FilePath path; 386 FilePath path;
380 if (!GetTempDir(&path)) 387 if (!GetTempDir(&path))
381 return false; 388 return false;
382 *path_str = path.ToWStringHack(); 389 *path_str = path.ToWStringHack();
383 return true; 390 return true;
384 } 391 }
392 bool Move(const std::wstring& from_path, const std::wstring& to_path) {
393 return Move(FilePath::FromWStringHack(from_path),
394 FilePath::FromWStringHack(to_path));
395 }
385 FILE* OpenFile(const std::wstring& filename, const char* mode) { 396 FILE* OpenFile(const std::wstring& filename, const char* mode) {
386 return OpenFile(FilePath::FromWStringHack(filename), mode); 397 return OpenFile(FilePath::FromWStringHack(filename), mode);
387 } 398 }
399 bool PathExists(const std::wstring& path) {
400 return PathExists(FilePath::FromWStringHack(path));
401 }
388 int ReadFile(const std::wstring& filename, char* data, int size) { 402 int ReadFile(const std::wstring& filename, char* data, int size) {
389 return ReadFile(FilePath::FromWStringHack(filename), data, size); 403 return ReadFile(FilePath::FromWStringHack(filename), data, size);
390 } 404 }
391 bool SetCurrentDirectory(const std::wstring& directory) { 405 bool SetCurrentDirectory(const std::wstring& directory) {
392 return SetCurrentDirectory(FilePath::FromWStringHack(directory)); 406 return SetCurrentDirectory(FilePath::FromWStringHack(directory));
393 } 407 }
394 void UpOneDirectory(std::wstring* dir) { 408 void UpOneDirectory(std::wstring* dir) {
395 FilePath path = FilePath::FromWStringHack(*dir); 409 FilePath path = FilePath::FromWStringHack(*dir);
396 FilePath directory = path.DirName(); 410 FilePath directory = path.DirName();
397 // If there is no separator, we will get back kCurrentDirectory. 411 // If there is no separator, we will get back kCurrentDirectory.
(...skipping 27 matching lines...) Expand all
425 439
426 bool FileEnumerator::IsDot(const FilePath& path) { 440 bool FileEnumerator::IsDot(const FilePath& path) {
427 return FILE_PATH_LITERAL(".") == path.BaseName().value(); 441 return FILE_PATH_LITERAL(".") == path.BaseName().value();
428 } 442 }
429 443
430 bool FileEnumerator::IsDotDot(const FilePath& path) { 444 bool FileEnumerator::IsDotDot(const FilePath& path) {
431 return FILE_PATH_LITERAL("..") == path.BaseName().value(); 445 return FILE_PATH_LITERAL("..") == path.BaseName().value();
432 } 446 }
433 447
434 } // namespace 448 } // namespace
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | chrome/browser/first_run_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698