Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: base/files/file_util_posix.cc

Issue 2577163002: A follow-up nit fix for jumplist file operations (Closed)
Patch Set: Fix nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/files/file_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/files/file_util.h" 5 #include "base/files/file_util.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <libgen.h> 10 #include <libgen.h>
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (real_to_path.empty()) 269 if (real_to_path.empty())
270 return false; 270 return false;
271 } else { 271 } else {
272 real_to_path = MakeAbsoluteFilePath(real_to_path.DirName()); 272 real_to_path = MakeAbsoluteFilePath(real_to_path.DirName());
273 if (real_to_path.empty()) 273 if (real_to_path.empty())
274 return false; 274 return false;
275 } 275 }
276 FilePath real_from_path = MakeAbsoluteFilePath(from_path); 276 FilePath real_from_path = MakeAbsoluteFilePath(from_path);
277 if (real_from_path.empty()) 277 if (real_from_path.empty())
278 return false; 278 return false;
279 if (real_to_path.value().size() >= real_from_path.value().size() && 279 if (real_to_path == real_from_path || real_from_path.IsParent(real_to_path))
280 real_to_path.value().compare(0, real_from_path.value().size(),
281 real_from_path.value()) == 0) {
282 return false; 280 return false;
283 }
284 281
285 int traverse_type = FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS; 282 int traverse_type = FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS;
286 if (recursive) 283 if (recursive)
287 traverse_type |= FileEnumerator::DIRECTORIES; 284 traverse_type |= FileEnumerator::DIRECTORIES;
288 FileEnumerator traversal(from_path, recursive, traverse_type); 285 FileEnumerator traversal(from_path, recursive, traverse_type);
289 286
290 // We have to mimic windows behavior here. |to_path| may not exist yet, 287 // We have to mimic windows behavior here. |to_path| may not exist yet,
291 // start the loop with |to_path|. 288 // start the loop with |to_path|.
292 struct stat from_stat; 289 struct stat from_stat;
293 FilePath current = from_path; 290 FilePath current = from_path;
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 return false; 982 return false;
986 983
987 DeleteFile(from_path, true); 984 DeleteFile(from_path, true);
988 return true; 985 return true;
989 } 986 }
990 987
991 } // namespace internal 988 } // namespace internal
992 989
993 #endif // !defined(OS_NACL_NONSFI) 990 #endif // !defined(OS_NACL_NONSFI)
994 } // namespace base 991 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/files/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698