From 5974b39719e6fffe2e7eeacb0c026d5908274e62 Mon Sep 17 00:00:00 2001 From: dpranke Date: Thu, 7 May 2015 14:48:37 -0700 Subject: [PATCH] Adjust the way GN resolves command line args into files or labels. Previously, given a command line argument that could legally be either a file or a label, we would check to see if it was a label first. If the arg happened to be a filename containing parentheses, this would result in an error complaining about an unrecognized toolchain. Now we check to see if the arg refers to an existing file first. If the arg does not refer to an existing file, we attempt to resolve it as a label, and only after we fail to match it as a label to we fall back to treating it as a (non-existent) file again. This means that we'll still give errors on filenames that contain parentheses that don't exist, but hopefully that happens less often. R=brettw@chromium.org BUG=485386 Review URL: https://codereview.chromium.org/1123353005 Cr-Commit-Position: refs/heads/master@{#328846} --- tools/gn/commands.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/gn/commands.cc b/tools/gn/commands.cc index 81adf3450e12..3c7ea20ee7b0 100644 --- a/tools/gn/commands.cc +++ b/tools/gn/commands.cc @@ -89,8 +89,10 @@ bool ResolveStringFromCommandLineInput( setup->loader()->default_toolchain_label(), Value(nullptr, input), &err); if (err.has_error()) { - err.PrintToStdout(); - return false; + // Not a valid label, assume this must be a file. + file_matches->push_back(current_dir.ResolveRelativeFile( + input, setup->build_settings().root_path_utf8())); + return true; } const Item* item = setup->builder()->GetItem(label); -- 2.11.4.GIT