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

Side by Side Diff: base/file_util.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 months 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 | Annotate | Revision Log
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/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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 const FilePath& path, 271 const FilePath& path,
272 const FilePath::StringType& suffix) { 272 const FilePath::StringType& suffix) {
273 bool have_suffix = !suffix.empty(); 273 bool have_suffix = !suffix.empty();
274 if (!PathExists(path) && 274 if (!PathExists(path) &&
275 (!have_suffix || !PathExists(FilePath(path.value() + suffix)))) { 275 (!have_suffix || !PathExists(FilePath(path.value() + suffix)))) {
276 return 0; 276 return 0;
277 } 277 }
278 278
279 FilePath new_path; 279 FilePath new_path;
280 for (int count = 1; count <= kMaxUniqueFiles; ++count) { 280 for (int count = 1; count <= kMaxUniqueFiles; ++count) {
281 new_path = path.InsertBeforeExtensionASCII(StringPrintf(" (%d)", count)); 281 new_path =
282 path.InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", count));
282 if (!PathExists(new_path) && 283 if (!PathExists(new_path) &&
283 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { 284 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) {
284 return count; 285 return count;
285 } 286 }
286 } 287 }
287 288
288 return -1; 289 return -1;
289 } 290 }
290 291
291 bool ContainsPath(const FilePath &parent, const FilePath& child) { 292 bool ContainsPath(const FilePath &parent, const FilePath& child) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // FileEnumerator 355 // FileEnumerator
355 // 356 //
356 // Note: the main logic is in file_util_<platform>.cc 357 // Note: the main logic is in file_util_<platform>.cc
357 358
358 bool FileEnumerator::ShouldSkip(const FilePath& path) { 359 bool FileEnumerator::ShouldSkip(const FilePath& path) {
359 FilePath::StringType basename = path.BaseName().value(); 360 FilePath::StringType basename = path.BaseName().value();
360 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); 361 return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_));
361 } 362 }
362 363
363 } // namespace 364 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698