| OLD | NEW |
| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return base::FilePath(); | 123 return base::FilePath(); |
| 124 | 124 |
| 125 std::string converted; | 125 std::string converted; |
| 126 if (is_system_absolute()) { | 126 if (is_system_absolute()) { |
| 127 if (value_.size() > 2 && value_[2] == ':') { | 127 if (value_.size() > 2 && value_[2] == ':') { |
| 128 // Windows path, strip the leading slash. | 128 // Windows path, strip the leading slash. |
| 129 converted.assign(&value_[1], value_.size() - 1); | 129 converted.assign(&value_[1], value_.size() - 1); |
| 130 } else { | 130 } else { |
| 131 converted.assign(value_); | 131 converted.assign(value_); |
| 132 } | 132 } |
| 133 ConvertPathToSystem(&converted); | |
| 134 return base::FilePath(UTF8ToFilePath(converted)); | 133 return base::FilePath(UTF8ToFilePath(converted)); |
| 135 } | 134 } |
| 136 | 135 |
| 137 // String the double-leading slash for source-relative paths. | 136 // String the double-leading slash for source-relative paths. |
| 138 converted.assign(&value_[2], value_.size() - 2); | 137 converted.assign(&value_[2], value_.size() - 2); |
| 139 ConvertPathToSystem(&converted); | 138 return source_root.Append(UTF8ToFilePath(converted)) |
| 140 return source_root.Append(UTF8ToFilePath(converted)); | 139 .NormalizePathSeparatorsTo('/'); |
| 141 } | 140 } |
| 142 | 141 |
| 143 void SourceDir::SwapValue(std::string* v) { | 142 void SourceDir::SwapValue(std::string* v) { |
| 144 value_.swap(*v); | 143 value_.swap(*v); |
| 145 AssertValueSourceDirString(value_); | 144 AssertValueSourceDirString(value_); |
| 146 } | 145 } |
| OLD | NEW |