| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (contents) | 153 if (contents) |
| 154 contents->append(buf, len); | 154 contents->append(buf, len); |
| 155 } | 155 } |
| 156 CloseFile(file); | 156 CloseFile(file); |
| 157 | 157 |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool IsDirectoryEmpty(const FilePath& dir_path) { | 161 bool IsDirectoryEmpty(const FilePath& dir_path) { |
| 162 FileEnumerator files(dir_path, false, | 162 FileEnumerator files(dir_path, false, |
| 163 static_cast<FileEnumerator::FILE_TYPE>( | 163 static_cast<FileEnumerator::FileType>( |
| 164 FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); | 164 FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); |
| 165 if (files.Next().value().empty()) | 165 if (files.Next().value().empty()) |
| 166 return true; | 166 return true; |
| 167 return false; | 167 return false; |
| 168 } | 168 } |
| 169 | 169 |
| 170 FILE* CreateAndOpenTemporaryFile(FilePath* path) { | 170 FILE* CreateAndOpenTemporaryFile(FilePath* path) { |
| 171 FilePath directory; | 171 FilePath directory; |
| 172 if (!GetTempDir(&directory)) | 172 if (!GetTempDir(&directory)) |
| 173 return NULL; | 173 return NULL; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // FileEnumerator | 393 // FileEnumerator |
| 394 // | 394 // |
| 395 // Note: the main logic is in file_util_<platform>.cc | 395 // Note: the main logic is in file_util_<platform>.cc |
| 396 | 396 |
| 397 bool FileEnumerator::ShouldSkip(const FilePath& path) { | 397 bool FileEnumerator::ShouldSkip(const FilePath& path) { |
| 398 FilePath::StringType basename = path.BaseName().value(); | 398 FilePath::StringType basename = path.BaseName().value(); |
| 399 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); | 399 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); |
| 400 } | 400 } |
| 401 | 401 |
| 402 } // namespace | 402 } // namespace |
| OLD | NEW |