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_file.h" | 5 #include "tools/gn/source_file.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "tools/gn/filesystem_utils.h" | 9 #include "tools/gn/filesystem_utils.h" |
10 #include "tools/gn/source_dir.h" | 10 #include "tools/gn/source_dir.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (value_.size() > 2 && value_[2] == ':') { | 57 if (value_.size() > 2 && value_[2] == ':') { |
58 // Windows path, strip the leading slash. | 58 // Windows path, strip the leading slash. |
59 converted.assign(&value_[1], value_.size() - 1); | 59 converted.assign(&value_[1], value_.size() - 1); |
60 } else { | 60 } else { |
61 converted.assign(value_); | 61 converted.assign(value_); |
62 } | 62 } |
63 return base::FilePath(UTF8ToFilePath(converted)); | 63 return base::FilePath(UTF8ToFilePath(converted)); |
64 } | 64 } |
65 | 65 |
66 converted.assign(&value_[2], value_.size() - 2); | 66 converted.assign(&value_[2], value_.size() - 2); |
| 67 if (source_root.empty()) |
| 68 return UTF8ToFilePath(converted).NormalizePathSeparatorsTo('/'); |
67 return source_root.Append(UTF8ToFilePath(converted)) | 69 return source_root.Append(UTF8ToFilePath(converted)) |
68 .NormalizePathSeparatorsTo('/'); | 70 .NormalizePathSeparatorsTo('/'); |
69 } | 71 } |
OLD | NEW |