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::FileType>( | 34 (FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); |
jar (doing other things)
2012/08/06 18:27:02
nit: remove extra paren around arg 3, and push lin
Haruki Sato
2012/08/06 23:22:18
Done.
| |
35 FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); | |
36 for (FilePath path = path_enum.Next(); is_identical && !path.empty(); | 35 for (FilePath path = path_enum.Next(); is_identical && !path.empty(); |
37 path = path_enum.Next()) { | 36 path = path_enum.Next()) { |
38 is_identical = | 37 is_identical = |
39 IsIdenticalFileHierarchy(path, dest_path.Append(path.BaseName())); | 38 IsIdenticalFileHierarchy(path, dest_path.Append(path.BaseName())); |
40 } | 39 } |
41 } else { | 40 } else { |
42 // The two paths are of different types, so they cannot be identical. | 41 // The two paths are of different types, so they cannot be identical. |
43 DCHECK(!is_identical); | 42 DCHECK(!is_identical); |
44 } | 43 } |
45 } | 44 } |
46 | 45 |
47 return is_identical; | 46 return is_identical; |
48 } | 47 } |
49 | 48 |
50 } // namespace installer | 49 } // namespace installer |
OLD | NEW |