Chromium Code Reviews| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 if (contents) | 163 if (contents) |
| 164 contents->append(buf, len); | 164 contents->append(buf, len); |
| 165 } | 165 } |
| 166 CloseFile(file); | 166 CloseFile(file); |
| 167 | 167 |
| 168 return true; | 168 return true; |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool IsDirectoryEmpty(const FilePath& dir_path) { | 171 bool IsDirectoryEmpty(const FilePath& dir_path) { |
| 172 FileEnumerator files(dir_path, false, | 172 FileEnumerator files(dir_path, false, |
| 173 static_cast<FileEnumerator::FileType>( | 173 (FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); |
|
jar (doing other things)
2012/08/06 18:27:02
nit: parens don't seem needed (or add to readabili
| |
| 174 FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); | |
| 175 if (files.Next().value().empty()) | 174 if (files.Next().value().empty()) |
| 176 return true; | 175 return true; |
| 177 return false; | 176 return false; |
| 178 } | 177 } |
| 179 | 178 |
| 180 FILE* CreateAndOpenTemporaryFile(FilePath* path) { | 179 FILE* CreateAndOpenTemporaryFile(FilePath* path) { |
| 181 FilePath directory; | 180 FilePath directory; |
| 182 if (!GetTempDir(&directory)) | 181 if (!GetTempDir(&directory)) |
| 183 return NULL; | 182 return NULL; |
| 184 | 183 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 // FileEnumerator | 383 // FileEnumerator |
| 385 // | 384 // |
| 386 // Note: the main logic is in file_util_<platform>.cc | 385 // Note: the main logic is in file_util_<platform>.cc |
| 387 | 386 |
| 388 bool FileEnumerator::ShouldSkip(const FilePath& path) { | 387 bool FileEnumerator::ShouldSkip(const FilePath& path) { |
| 389 FilePath::StringType basename = path.BaseName().value(); | 388 FilePath::StringType basename = path.BaseName().value(); |
| 390 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); | 389 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); |
| 391 } | 390 } |
| 392 | 391 |
| 393 } // namespace | 392 } // namespace |
| OLD | NEW |