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

Side by Side Diff: base/file_util_posix.cc

Issue 9074: Port more of url_request_unittest.cc.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
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 <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <fnmatch.h> 9 #include <fnmatch.h>
10 #include <fts.h> 10 #include <fts.h>
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 for (std::vector<FilePath>::reverse_iterator i = subpaths.rbegin(); 304 for (std::vector<FilePath>::reverse_iterator i = subpaths.rbegin();
305 i != subpaths.rend(); ++i) { 305 i != subpaths.rend(); ++i) {
306 if (!DirectoryExists(*i)) { 306 if (!DirectoryExists(*i)) {
307 if (mkdir(i->value().c_str(), 0777) != 0) 307 if (mkdir(i->value().c_str(), 0777) != 0)
308 return false; 308 return false;
309 } 309 }
310 } 310 }
311 return true; 311 return true;
312 } 312 }
313 313
314 bool GetFileInfo(const std::wstring& file_path, FileInfo* results) { 314 bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
315 struct stat64 file_info; 315 struct stat64 file_info;
316 if (stat64(WideToUTF8(file_path).c_str(), &file_info) != 0) 316 if (stat64(file_path.value().c_str(), &file_info) != 0)
317 return false; 317 return false;
318 results->is_directory = S_ISDIR(file_info.st_mode); 318 results->is_directory = S_ISDIR(file_info.st_mode);
319 results->size = file_info.st_size; 319 results->size = file_info.st_size;
320 return true; 320 return true;
321 } 321 }
322 322
323 FILE* OpenFile(const std::string& filename, const char* mode) { 323 FILE* OpenFile(const std::string& filename, const char* mode) {
324 return fopen(filename.c_str(), mode); 324 return fopen(filename.c_str(), mode);
325 } 325 }
326 326
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next(); 463 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next();
464 } else if (fts_ent->fts_info == FTS_F) { 464 } else if (fts_ent->fts_info == FTS_F) {
465 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next(); 465 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next();
466 } 466 }
467 // TODO(erikkay) - verify that the other fts_info types aren't interesting 467 // TODO(erikkay) - verify that the other fts_info types aren't interesting
468 return Next(); 468 return Next();
469 } 469 }
470 470
471 471
472 } // namespace file_util 472 } // namespace file_util
OLDNEW
« base/file_util.cc ('K') | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698