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

Side by Side Diff: base/file_util.cc

Issue 276016: Remove some deprecated file_util wstring functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: lint 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 }
329 bool CreateDirectory(const std::wstring& full_path) { 325 bool CreateDirectory(const std::wstring& full_path) {
330 return CreateDirectory(FilePath::FromWStringHack(full_path)); 326 return CreateDirectory(FilePath::FromWStringHack(full_path));
331 } 327 }
332 bool CreateNewTempDirectory(const std::wstring& prefix, 328 bool CreateNewTempDirectory(const std::wstring& prefix,
333 std::wstring* new_temp_path) { 329 std::wstring* new_temp_path) {
334 #if defined(OS_WIN) 330 #if defined(OS_WIN)
335 FilePath::StringType dir_prefix(prefix); 331 FilePath::StringType dir_prefix(prefix);
336 #elif defined(OS_POSIX) 332 #elif defined(OS_POSIX)
337 FilePath::StringType dir_prefix = WideToUTF8(prefix); 333 FilePath::StringType dir_prefix = WideToUTF8(prefix);
338 #endif 334 #endif
339 FilePath temp_path; 335 FilePath temp_path;
340 if (!CreateNewTempDirectory(dir_prefix, &temp_path)) 336 if (!CreateNewTempDirectory(dir_prefix, &temp_path))
341 return false; 337 return false;
342 *new_temp_path = temp_path.ToWStringHack(); 338 *new_temp_path = temp_path.ToWStringHack();
343 return true; 339 return true;
344 } 340 }
345 bool Delete(const std::wstring& path, bool recursive) { 341 bool Delete(const std::wstring& path, bool recursive) {
346 return Delete(FilePath::FromWStringHack(path), recursive); 342 return Delete(FilePath::FromWStringHack(path), recursive);
347 } 343 }
348 bool DirectoryExists(const std::wstring& path) {
349 return DirectoryExists(FilePath::FromWStringHack(path));
350 }
351 bool EndsWithSeparator(std::wstring* path) { 344 bool EndsWithSeparator(std::wstring* path) {
352 return EndsWithSeparator(FilePath::FromWStringHack(*path)); 345 return EndsWithSeparator(FilePath::FromWStringHack(*path));
353 } 346 }
354 bool EndsWithSeparator(const std::wstring& path) { 347 bool EndsWithSeparator(const std::wstring& path) {
355 return EndsWithSeparator(FilePath::FromWStringHack(path)); 348 return EndsWithSeparator(FilePath::FromWStringHack(path));
356 } 349 }
357 bool GetCurrentDirectory(std::wstring* path_str) { 350 bool GetCurrentDirectory(std::wstring* path_str) {
358 FilePath path; 351 FilePath path;
359 if (!GetCurrentDirectory(&path)) 352 if (!GetCurrentDirectory(&path))
360 return false; 353 return false;
(...skipping 21 matching lines...) Expand all
382 bool GetFileSize(const std::wstring& file_path, int64* file_size) { 375 bool GetFileSize(const std::wstring& file_path, int64* file_size) {
383 return GetFileSize(FilePath::FromWStringHack(file_path), file_size); 376 return GetFileSize(FilePath::FromWStringHack(file_path), file_size);
384 } 377 }
385 bool GetTempDir(std::wstring* path_str) { 378 bool GetTempDir(std::wstring* path_str) {
386 FilePath path; 379 FilePath path;
387 if (!GetTempDir(&path)) 380 if (!GetTempDir(&path))
388 return false; 381 return false;
389 *path_str = path.ToWStringHack(); 382 *path_str = path.ToWStringHack();
390 return true; 383 return true;
391 } 384 }
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 }
396 FILE* OpenFile(const std::wstring& filename, const char* mode) { 385 FILE* OpenFile(const std::wstring& filename, const char* mode) {
397 return OpenFile(FilePath::FromWStringHack(filename), mode); 386 return OpenFile(FilePath::FromWStringHack(filename), mode);
398 } 387 }
399 bool PathExists(const std::wstring& path) {
400 return PathExists(FilePath::FromWStringHack(path));
401 }
402 int ReadFile(const std::wstring& filename, char* data, int size) { 388 int ReadFile(const std::wstring& filename, char* data, int size) {
403 return ReadFile(FilePath::FromWStringHack(filename), data, size); 389 return ReadFile(FilePath::FromWStringHack(filename), data, size);
404 } 390 }
405 bool SetCurrentDirectory(const std::wstring& directory) { 391 bool SetCurrentDirectory(const std::wstring& directory) {
406 return SetCurrentDirectory(FilePath::FromWStringHack(directory)); 392 return SetCurrentDirectory(FilePath::FromWStringHack(directory));
407 } 393 }
408 void UpOneDirectory(std::wstring* dir) { 394 void UpOneDirectory(std::wstring* dir) {
409 FilePath path = FilePath::FromWStringHack(*dir); 395 FilePath path = FilePath::FromWStringHack(*dir);
410 FilePath directory = path.DirName(); 396 FilePath directory = path.DirName();
411 // If there is no separator, we will get back kCurrentDirectory. 397 // If there is no separator, we will get back kCurrentDirectory.
(...skipping 27 matching lines...) Expand all
439 425
440 bool FileEnumerator::IsDot(const FilePath& path) { 426 bool FileEnumerator::IsDot(const FilePath& path) {
441 return FILE_PATH_LITERAL(".") == path.BaseName().value(); 427 return FILE_PATH_LITERAL(".") == path.BaseName().value();
442 } 428 }
443 429
444 bool FileEnumerator::IsDotDot(const FilePath& path) { 430 bool FileEnumerator::IsDotDot(const FilePath& path) {
445 return FILE_PATH_LITERAL("..") == path.BaseName().value(); 431 return FILE_PATH_LITERAL("..") == path.BaseName().value();
446 } 432 }
447 433
448 } // namespace 434 } // 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