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

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

Issue 2692273008: Hacky slashy (Closed)
Patch Set: wip Created 3 years, 10 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
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_path.h" 5 #include "base/files/file_path.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 suffix.AppendToString(&ret); 418 suffix.AppendToString(&ret);
419 ret.append(ext); 419 ret.append(ext);
420 return FilePath(ret); 420 return FilePath(ret);
421 } 421 }
422 422
423 FilePath FilePath::InsertBeforeExtensionASCII(StringPiece suffix) 423 FilePath FilePath::InsertBeforeExtensionASCII(StringPiece suffix)
424 const { 424 const {
425 DCHECK(IsStringASCII(suffix)); 425 DCHECK(IsStringASCII(suffix));
426 #if defined(OS_WIN) 426 #if defined(OS_WIN)
427 return InsertBeforeExtension(ASCIIToUTF16(suffix)); 427 return InsertBeforeExtension(ASCIIToUTF16(suffix));
428 #elif defined(OS_POSIX) 428 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
429 return InsertBeforeExtension(suffix); 429 return InsertBeforeExtension(suffix);
430 #endif 430 #endif
431 } 431 }
432 432
433 FilePath FilePath::AddExtension(StringPieceType extension) const { 433 FilePath FilePath::AddExtension(StringPieceType extension) const {
434 if (IsEmptyOrSpecialCase(BaseName().value())) 434 if (IsEmptyOrSpecialCase(BaseName().value()))
435 return FilePath(); 435 return FilePath();
436 436
437 // If the new extension is "" or ".", then just return the current FilePath. 437 // If the new extension is "" or ".", then just return the current FilePath.
438 if (extension.empty() || 438 if (extension.empty() ||
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 FilePath FilePath::Append(const FilePath& component) const { 523 FilePath FilePath::Append(const FilePath& component) const {
524 return Append(component.value()); 524 return Append(component.value());
525 } 525 }
526 526
527 FilePath FilePath::AppendASCII(StringPiece component) const { 527 FilePath FilePath::AppendASCII(StringPiece component) const {
528 DCHECK(base::IsStringASCII(component)); 528 DCHECK(base::IsStringASCII(component));
529 #if defined(OS_WIN) 529 #if defined(OS_WIN)
530 return Append(ASCIIToUTF16(component)); 530 return Append(ASCIIToUTF16(component));
531 #elif defined(OS_POSIX) 531 #elif defined(OS_POSIX) || defined(OS_FUCHSIA)
532 return Append(component); 532 return Append(component);
533 #endif 533 #endif
534 } 534 }
535 535
536 bool FilePath::IsAbsolute() const { 536 bool FilePath::IsAbsolute() const {
537 return IsPathAbsolute(path_); 537 return IsPathAbsolute(path_);
538 } 538 }
539 539
540 bool FilePath::EndsWithSeparator() const { 540 bool FilePath::EndsWithSeparator() const {
541 if (empty()) 541 if (empty())
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 #endif 1336 #endif
1337 } 1337 }
1338 1338
1339 #if defined(OS_ANDROID) 1339 #if defined(OS_ANDROID)
1340 bool FilePath::IsContentUri() const { 1340 bool FilePath::IsContentUri() const {
1341 return StartsWith(path_, "content://", base::CompareCase::INSENSITIVE_ASCII); 1341 return StartsWith(path_, "content://", base::CompareCase::INSENSITIVE_ASCII);
1342 } 1342 }
1343 #endif 1343 #endif
1344 1344
1345 } // namespace base 1345 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698