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/build_settings.h" | 5 #include "tools/gn/build_settings.h" |
6 #include "tools/gn/filesystem_utils.h" | 6 #include "tools/gn/filesystem_utils.h" |
7 #include "tools/gn/functions.h" | 7 #include "tools/gn/functions.h" |
8 #include "tools/gn/parse_tree.h" | 8 #include "tools/gn/parse_tree.h" |
9 #include "tools/gn/scope.h" | 9 #include "tools/gn/scope.h" |
10 #include "tools/gn/settings.h" | 10 #include "tools/gn/settings.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 " your tool is expecting.\n" | 164 " your tool is expecting.\n" |
165 "\n" | 165 "\n" |
166 " The common case is to use this to convert paths relative to the\n" | 166 " The common case is to use this to convert paths relative to the\n" |
167 " current directory to be relative to the build directory (which will\n" | 167 " current directory to be relative to the build directory (which will\n" |
168 " be the current directory when executing scripts).\n" | 168 " be the current directory when executing scripts).\n" |
169 "\n" | 169 "\n" |
170 "Arguments\n" | 170 "Arguments\n" |
171 "\n" | 171 "\n" |
172 " input\n" | 172 " input\n" |
173 " A string or list of strings representing file or directory names\n" | 173 " A string or list of strings representing file or directory names\n" |
174 " These can be relative paths (\"foo/bar.txt\", system absolte paths\n" | 174 " These can be relative paths (\"foo/bar.txt\"), system absolute\n" |
175 " (\"/foo/bar.txt\"), or source absolute paths (\"//foo/bar.txt\").\n" | 175 " paths (\"/foo/bar.txt\"), or source absolute paths\n" |
| 176 " (\"//foo/bar.txt\").\n" |
176 "\n" | 177 "\n" |
177 " current_base\n" | 178 " current_base\n" |
178 " Directory representing the base for relative paths in the input.\n" | 179 " Directory representing the base for relative paths in the input.\n" |
179 " If this is not an absolute path, it will be treated as being\n" | 180 " If this is not an absolute path, it will be treated as being\n" |
180 " relative to the current build file. Use \".\" to convert paths\n" | 181 " relative to the current build file. Use \".\" to convert paths\n" |
181 " from the current BUILD-file's directory.\n" | 182 " from the current BUILD-file's directory.\n" |
182 "\n" | 183 "\n" |
183 " new_base\n" | 184 " new_base\n" |
184 " The directory to convert the paths to be relative to. As with the\n" | 185 " The directory to convert the paths to be relative to. As with the\n" |
185 " current_base, this can be a relative path, which will be treated\n" | 186 " current_base, this can be a relative path, which will be treated\n" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } else { | 276 } else { |
276 to_dir = current_dir.ResolveRelativeDir(args[2].string_value()); | 277 to_dir = current_dir.ResolveRelativeDir(args[2].string_value()); |
277 } | 278 } |
278 | 279 |
279 // Path conversion. | 280 // Path conversion. |
280 SeparatorConversion sep_conversion = SEP_NO_CHANGE; | 281 SeparatorConversion sep_conversion = SEP_NO_CHANGE; |
281 if (args.size() == 4) { | 282 if (args.size() == 4) { |
282 if (convert_to_system_absolute) { | 283 if (convert_to_system_absolute) { |
283 *err = Err(function, "Can't specify slash conversion.", | 284 *err = Err(function, "Can't specify slash conversion.", |
284 "You specified absolute system path output by using an empty string " | 285 "You specified absolute system path output by using an empty string " |
285 "for the desination directory on rebase_path(). In this case, you " | 286 "for the destination directory on rebase_path(). In this case, you " |
286 "can't specify slash conversion."); | 287 "can't specify slash conversion."); |
287 return result; | 288 return result; |
288 } | 289 } |
289 | 290 |
290 if (!args[3].VerifyTypeIs(Value::STRING, err)) | 291 if (!args[3].VerifyTypeIs(Value::STRING, err)) |
291 return result; | 292 return result; |
292 const std::string& sep_string = args[3].string_value(); | 293 const std::string& sep_string = args[3].string_value(); |
293 if (sep_string == "to_system") { | 294 if (sep_string == "to_system") { |
294 sep_conversion = SEP_TO_SYSTEM; | 295 sep_conversion = SEP_TO_SYSTEM; |
295 } else if (sep_string == "from_system") { | 296 } else if (sep_string == "from_system") { |
(...skipping 27 matching lines...) Expand all Loading... |
323 } | 324 } |
324 return result; | 325 return result; |
325 } | 326 } |
326 | 327 |
327 *err = Err(function->function(), | 328 *err = Err(function->function(), |
328 "rebase_path requires a list or a string."); | 329 "rebase_path requires a list or a string."); |
329 return result; | 330 return result; |
330 } | 331 } |
331 | 332 |
332 } // namespace functions | 333 } // namespace functions |
OLD | NEW |