| 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/test/test_file_util.h" | 5 #include "base/test/test_file_util.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } else { | 94 } else { |
| 95 real_to_path = real_to_path.DirName(); | 95 real_to_path = real_to_path.DirName(); |
| 96 if (!AbsolutePath(&real_to_path)) | 96 if (!AbsolutePath(&real_to_path)) |
| 97 return false; | 97 return false; |
| 98 } | 98 } |
| 99 if (real_to_path.value().compare(0, source_dir.value().size(), | 99 if (real_to_path.value().compare(0, source_dir.value().size(), |
| 100 source_dir.value()) == 0) | 100 source_dir.value()) == 0) |
| 101 return false; | 101 return false; |
| 102 | 102 |
| 103 bool success = true; | 103 bool success = true; |
| 104 FileEnumerator::FileType traverse_type = | 104 int traverse_type = FileEnumerator::FILES | |
| 105 static_cast<FileEnumerator::FileType>(FileEnumerator::FILES | | 105 FileEnumerator::SHOW_SYM_LINKS | FileEnumerator::DIRECTORIES; |
| 106 FileEnumerator::SHOW_SYM_LINKS | FileEnumerator::DIRECTORIES); | |
| 107 FileEnumerator traversal(source_dir, true, traverse_type); | 106 FileEnumerator traversal(source_dir, true, traverse_type); |
| 108 | 107 |
| 109 // dest_dir may not exist yet, start the loop with dest_dir | 108 // dest_dir may not exist yet, start the loop with dest_dir |
| 110 FileEnumerator::FindInfo info; | 109 FileEnumerator::FindInfo info; |
| 111 FilePath current = source_dir; | 110 FilePath current = source_dir; |
| 112 if (stat(source_dir.value().c_str(), &info.stat) < 0) { | 111 if (stat(source_dir.value().c_str(), &info.stat) < 0) { |
| 113 DLOG(ERROR) << "CopyRecursiveDirNoCache() couldn't stat source directory: " | 112 DLOG(ERROR) << "CopyRecursiveDirNoCache() couldn't stat source directory: " |
| 114 << source_dir.value() << " errno = " << errno; | 113 << source_dir.value() << " errno = " << errno; |
| 115 success = false; | 114 success = false; |
| 116 } | 115 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 DCHECK(info_ != NULL); | 182 DCHECK(info_ != NULL); |
| 184 DCHECK_NE(0u, length_); | 183 DCHECK_NE(0u, length_); |
| 185 } | 184 } |
| 186 | 185 |
| 187 PermissionRestorer::~PermissionRestorer() { | 186 PermissionRestorer::~PermissionRestorer() { |
| 188 if (!RestorePermissionInfo(path_, info_, length_)) | 187 if (!RestorePermissionInfo(path_, info_, length_)) |
| 189 NOTREACHED(); | 188 NOTREACHED(); |
| 190 } | 189 } |
| 191 | 190 |
| 192 } // namespace file_util | 191 } // namespace file_util |
| OLD | NEW |