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

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: restore convert_slashes in output path, misc fixes 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
« no previous file with comments | « tools/gn/filesystem_utils.h ('k') | tools/gn/function_rebase_path.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) 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 void ConvertPathToSystem(std::string* path) { 556 void ConvertPathToSystem(std::string* path) {
557 #if defined(OS_WIN) 557 #if defined(OS_WIN)
558 for (size_t i = 0; i < path->size(); i++) { 558 for (size_t i = 0; i < path->size(); i++) {
559 if ((*path)[i] == '/') 559 if ((*path)[i] == '/')
560 (*path)[i] = '\\'; 560 (*path)[i] = '\\';
561 } 561 }
562 #endif 562 #endif
563 } 563 }
564 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, 565 std::string RebaseSourceAbsolutePath(const std::string& input,
572 const SourceDir& dest_dir) { 566 const SourceDir& dest_dir) {
573 CHECK(input.size() >= 2 && input[0] == '/' && input[1] == '/') 567 CHECK(input.size() >= 2 && input[0] == '/' && input[1] == '/')
574 << "Input to rebase isn't source-absolute: " << input; 568 << "Input to rebase isn't source-absolute: " << input;
575 CHECK(dest_dir.is_source_absolute()) 569 CHECK(dest_dir.is_source_absolute())
576 << "Dir to rebase to isn't source-absolute: " << dest_dir.value(); 570 << "Dir to rebase to isn't source-absolute: " << dest_dir.value();
577 571
578 const std::string& dest = dest_dir.value(); 572 const std::string& dest = dest_dir.value();
579 573
580 // Skip the common prefixes of the source and dest as long as they end in 574 // 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()); 724 return GetGenDirForSourceDir(target->settings(), target->label().dir());
731 } 725 }
732 726
733 SourceDir GetCurrentOutputDir(const Scope* scope) { 727 SourceDir GetCurrentOutputDir(const Scope* scope) {
734 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); 728 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir());
735 } 729 }
736 730
737 SourceDir GetCurrentGenDir(const Scope* scope) { 731 SourceDir GetCurrentGenDir(const Scope* scope) {
738 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); 732 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir());
739 } 733 }
OLDNEW
« no previous file with comments | « tools/gn/filesystem_utils.h ('k') | tools/gn/function_rebase_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698