| 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 | 5 |
| 6 #include "chrome/installer/util/duplicate_tree_detector.h" | 6 #include "chrome/installer/util/duplicate_tree_detector.h" |
| 7 | 7 |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Two files are "identical" if the file sizes are equivalent. | 24 // Two files are "identical" if the file sizes are equivalent. |
| 25 is_identical = src_info.size == dest_info.size; | 25 is_identical = src_info.size == dest_info.size; |
| 26 } else if (src_info.is_directory && dest_info.is_directory) { | 26 } else if (src_info.is_directory && dest_info.is_directory) { |
| 27 // Two directories are "identical" if dest_path contains entries that are | 27 // Two directories are "identical" if dest_path contains entries that are |
| 28 // "identical" to all the entries in src_path. | 28 // "identical" to all the entries in src_path. |
| 29 is_identical = true; | 29 is_identical = true; |
| 30 | 30 |
| 31 FileEnumerator path_enum( | 31 FileEnumerator path_enum( |
| 32 src_path, | 32 src_path, |
| 33 false, // Not recursive | 33 false, // Not recursive |
| 34 static_cast<FileEnumerator::FILE_TYPE>( | 34 static_cast<FileEnumerator::FileType>( |
| 35 FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); | 35 FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); |
| 36 for (FilePath path = path_enum.Next(); is_identical && !path.empty(); | 36 for (FilePath path = path_enum.Next(); is_identical && !path.empty(); |
| 37 path = path_enum.Next()) { | 37 path = path_enum.Next()) { |
| 38 is_identical = | 38 is_identical = |
| 39 IsIdenticalFileHierarchy(path, dest_path.Append(path.BaseName())); | 39 IsIdenticalFileHierarchy(path, dest_path.Append(path.BaseName())); |
| 40 } | 40 } |
| 41 } else { | 41 } else { |
| 42 // The two paths are of different types, so they cannot be identical. | 42 // The two paths are of different types, so they cannot be identical. |
| 43 DCHECK(!is_identical); | 43 DCHECK(!is_identical); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 return is_identical; | 47 return is_identical; |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace installer | 50 } // namespace installer |
| OLD | NEW |