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

Side by Side Diff: tools/gn/filesystem_utils.cc

Issue 213353004: GN: Move towards only using / on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only generate / in various places Created 6 years, 8 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "tools/gn/filesystem_utils.h" 5 #include "tools/gn/filesystem_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 src_i++; 546 src_i++;
547 } 547 }
548 } else { 548 } else {
549 // Input nothing special, just copy it. 549 // Input nothing special, just copy it.
550 pathbuf[dest_i++] = pathbuf[src_i++]; 550 pathbuf[dest_i++] = pathbuf[src_i++];
551 } 551 }
552 } 552 }
553 path->resize(dest_i); 553 path->resize(dest_i);
554 } 554 }
555 555
556 void ConvertPathToSystem(std::string* path) {
557 #if defined(OS_WIN)
558 for (size_t i = 0; i < path->size(); i++) {
559 if ((*path)[i] == '/')
560 (*path)[i] = '\\';
561 }
562 #endif
563 }
564
565 std::string PathToSystem(const std::string& path) {
566 std::string ret(path);
567 ConvertPathToSystem(&ret);
568 return ret;
569 }
570
571 std::string RebaseSourceAbsolutePath(const std::string& input, 556 std::string RebaseSourceAbsolutePath(const std::string& input,
572 const SourceDir& dest_dir) { 557 const SourceDir& dest_dir) {
573 CHECK(input.size() >= 2 && input[0] == '/' && input[1] == '/') 558 CHECK(input.size() >= 2 && input[0] == '/' && input[1] == '/')
574 << "Input to rebase isn't source-absolute: " << input; 559 << "Input to rebase isn't source-absolute: " << input;
575 CHECK(dest_dir.is_source_absolute()) 560 CHECK(dest_dir.is_source_absolute())
576 << "Dir to rebase to isn't source-absolute: " << dest_dir.value(); 561 << "Dir to rebase to isn't source-absolute: " << dest_dir.value();
577 562
578 const std::string& dest = dest_dir.value(); 563 const std::string& dest = dest_dir.value();
579 564
580 // Skip the common prefixes of the source and dest as long as they end in 565 // Skip the common prefixes of the source and dest as long as they end in
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 return GetGenDirForSourceDir(target->settings(), target->label().dir()); 715 return GetGenDirForSourceDir(target->settings(), target->label().dir());
731 } 716 }
732 717
733 SourceDir GetCurrentOutputDir(const Scope* scope) { 718 SourceDir GetCurrentOutputDir(const Scope* scope) {
734 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); 719 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir());
735 } 720 }
736 721
737 SourceDir GetCurrentGenDir(const Scope* scope) { 722 SourceDir GetCurrentGenDir(const Scope* scope) {
738 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); 723 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir());
739 } 724 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698