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

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

Issue 26561005: GYP generator for GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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/source_dir.h" 5 #include "tools/gn/source_dir.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "tools/gn/filesystem_utils.h" 8 #include "tools/gn/filesystem_utils.h"
9 #include "tools/gn/source_file.h" 9 #include "tools/gn/source_file.h"
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 return ret; 110 return ret;
111 } 111 }
112 112
113 base::FilePath SourceDir::Resolve(const base::FilePath& source_root) const { 113 base::FilePath SourceDir::Resolve(const base::FilePath& source_root) const {
114 if (is_null()) 114 if (is_null())
115 return base::FilePath(); 115 return base::FilePath();
116 116
117 std::string converted; 117 std::string converted;
118 if (is_system_absolute()) { 118 if (is_system_absolute()) {
119 converted = value_; 119 if (value_.size() > 2 && value_[2] == ':') {
120 // Windows path, strip the leading slash.
121 converted.assign(&value_[1], value_.size() - 1);
Evan Martin 2013/10/15 19:19:10 converted = value_.substr(1);
brettw 2013/10/15 20:18:01 Doesn't that make an extra temporary in < C++11?
122 } else {
123 converted.assign(value_);
124 }
120 ConvertPathToSystem(&converted); 125 ConvertPathToSystem(&converted);
121 return base::FilePath(UTF8ToFilePath(converted)); 126 return base::FilePath(UTF8ToFilePath(converted));
122 } 127 }
123 128
124 // String the double-leading slash for source-relative paths. 129 // String the double-leading slash for source-relative paths.
125 converted.assign(&value_[2], value_.size() - 2); 130 converted.assign(&value_[2], value_.size() - 2);
126 ConvertPathToSystem(&converted); 131 ConvertPathToSystem(&converted);
127 return source_root.Append(UTF8ToFilePath(converted)); 132 return source_root.Append(UTF8ToFilePath(converted));
128 } 133 }
129 134
130 void SourceDir::SwapInValue(std::string* v) { 135 void SourceDir::SwapInValue(std::string* v) {
131 value_.swap(*v); 136 value_.swap(*v);
132 AssertValueSourceDirString(value_); 137 AssertValueSourceDirString(value_);
133 } 138 }
OLDNEW
« tools/gn/setup.h ('K') | « tools/gn/setup.cc ('k') | tools/gn/source_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698