OLD | NEW |
1 // Copyright (c) 2012 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> |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 DLOG(ERROR) << "Couldn't open " << file_name.value(); | 376 DLOG(ERROR) << "Couldn't open " << file_name.value(); |
377 return false; | 377 return false; |
378 } | 378 } |
379 | 379 |
380 return MapFileToMemoryInternal(); | 380 return MapFileToMemoryInternal(); |
381 } | 381 } |
382 | 382 |
383 // Deprecated functions ---------------------------------------------------- | 383 // Deprecated functions ---------------------------------------------------- |
384 | 384 |
385 #if defined(OS_WIN) | 385 #if defined(OS_WIN) |
386 void AppendToPath(std::wstring* path, const std::wstring& new_ending) { | |
387 if (!path) { | |
388 NOTREACHED(); | |
389 return; // Don't crash in this function in release builds. | |
390 } | |
391 | |
392 if (!EndsWithSeparator(FilePath(*path))) | |
393 path->push_back(FilePath::kSeparators[0]); | |
394 path->append(new_ending); | |
395 } | |
396 | |
397 FILE* OpenFile(const std::wstring& filename, const char* mode) { | 386 FILE* OpenFile(const std::wstring& filename, const char* mode) { |
398 return OpenFile(FilePath::FromWStringHack(filename), mode); | 387 return OpenFile(FilePath::FromWStringHack(filename), mode); |
399 } | 388 } |
400 int ReadFile(const std::wstring& filename, char* data, int size) { | 389 int ReadFile(const std::wstring& filename, char* data, int size) { |
401 return ReadFile(FilePath::FromWStringHack(filename), data, size); | 390 return ReadFile(FilePath::FromWStringHack(filename), data, size); |
402 } | 391 } |
403 int WriteFile(const std::wstring& filename, const char* data, int size) { | 392 int WriteFile(const std::wstring& filename, const char* data, int size) { |
404 return WriteFile(FilePath::FromWStringHack(filename), data, size); | 393 return WriteFile(FilePath::FromWStringHack(filename), data, size); |
405 } | 394 } |
406 #endif // OS_WIN | 395 #endif // OS_WIN |
407 | 396 |
408 /////////////////////////////////////////////// | 397 /////////////////////////////////////////////// |
409 // FileEnumerator | 398 // FileEnumerator |
410 // | 399 // |
411 // Note: the main logic is in file_util_<platform>.cc | 400 // Note: the main logic is in file_util_<platform>.cc |
412 | 401 |
413 bool FileEnumerator::ShouldSkip(const FilePath& path) { | 402 bool FileEnumerator::ShouldSkip(const FilePath& path) { |
414 FilePath::StringType basename = path.BaseName().value(); | 403 FilePath::StringType basename = path.BaseName().value(); |
415 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); | 404 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); |
416 } | 405 } |
417 | 406 |
418 } // namespace | 407 } // namespace |
OLD | NEW |