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

Side by Side Diff: base/file_util.cc

Issue 17062: Keep trying to undo 7564. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 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_path_unittest.cc ('k') | base/file_util_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-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <fstream> 9 #include <fstream>
10 10
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 *path_str = path.ToWStringHack(); 374 *path_str = path.ToWStringHack();
375 return true; 375 return true;
376 } 376 }
377 bool GetFileInfo(const std::wstring& file_path, FileInfo* results) { 377 bool GetFileInfo(const std::wstring& file_path, FileInfo* results) {
378 return GetFileInfo(FilePath::FromWStringHack(file_path), results); 378 return GetFileInfo(FilePath::FromWStringHack(file_path), results);
379 } 379 }
380 std::wstring GetFilenameFromPath(const std::wstring& path) { 380 std::wstring GetFilenameFromPath(const std::wstring& path) {
381 if (path.empty() || EndsWithSeparator(path)) 381 if (path.empty() || EndsWithSeparator(path))
382 return std::wstring(); 382 return std::wstring();
383 383
384 #if defined(OS_WIN) 384 return FilePath::FromWStringHack(path).BaseName().ToWStringHack();
385 return FilePath::FromWStringHack(path).BaseName();
386 #elif defined(OS_POSIX)
387 return UTF8ToWide(FilePath::FromWStringHack(path).BaseName());
388 #endif
389 } 385 }
390 bool GetFileSize(const std::wstring& file_path, int64* file_size) { 386 bool GetFileSize(const std::wstring& file_path, int64* file_size) {
391 return GetFileSize(FilePath::FromWStringHack(file_path), file_size); 387 return GetFileSize(FilePath::FromWStringHack(file_path), file_size);
392 } 388 }
393 bool GetTempDir(std::wstring* path_str) { 389 bool GetTempDir(std::wstring* path_str) {
394 FilePath path; 390 FilePath path;
395 if (!GetTempDir(&path)) 391 if (!GetTempDir(&path))
396 return false; 392 return false;
397 *path_str = path.ToWStringHack(); 393 *path_str = path.ToWStringHack();
398 return true; 394 return true;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 FilePath directory = path.DirName(); 429 FilePath directory = path.DirName();
434 // If there is no separator, we will get back kCurrentDirectory. 430 // If there is no separator, we will get back kCurrentDirectory.
435 // In this case, clear dir. 431 // In this case, clear dir.
436 if (directory == path || directory.value() == FilePath::kCurrentDirectory) 432 if (directory == path || directory.value() == FilePath::kCurrentDirectory)
437 dir->clear(); 433 dir->clear();
438 else 434 else
439 *dir = directory.ToWStringHack(); 435 *dir = directory.ToWStringHack();
440 } 436 }
441 } // namespace 437 } // namespace
442 438
OLDNEW
« no previous file with comments | « base/file_path_unittest.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698