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 <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 // Ensure the file exists. Need to normalize path separators since on | 237 // Ensure the file exists. Need to normalize path separators since on |
238 // Windows they can come out as forward slashes here, and that confuses some | 238 // Windows they can come out as forward slashes here, and that confuses some |
239 // of the commands. | 239 // of the commands. |
240 base::FilePath arg_file = | 240 base::FilePath arg_file = |
241 setup.build_settings().GetFullPath(setup.GetBuildArgFile()) | 241 setup.build_settings().GetFullPath(setup.GetBuildArgFile()) |
242 .NormalizePathSeparators(); | 242 .NormalizePathSeparators(); |
243 if (!base::PathExists(arg_file)) { | 243 if (!base::PathExists(arg_file)) { |
244 std::string argfile_default_contents = | 244 std::string argfile_default_contents = |
245 "# Build arguments go here. Examples:\n" | 245 "# Build arguments go here. Examples:\n" |
246 "# enable_doom_melon = true\n" | 246 "# is_component_build = true\n" |
247 "# crazy_something = \"absolutely\"\n"; | 247 "# is_debug = false\n" |
| 248 "# See \"gn args <dir_name> --list\" for available build " |
| 249 "arguments.\n"; |
248 #if defined(OS_WIN) | 250 #if defined(OS_WIN) |
249 // Use Windows lineendings for this file since it will often open in | 251 // Use Windows lineendings for this file since it will often open in |
250 // Notepad which can't handle Unix ones. | 252 // Notepad which can't handle Unix ones. |
251 ReplaceSubstringsAfterOffset(&argfile_default_contents, 0, "\n", "\r\n"); | 253 ReplaceSubstringsAfterOffset(&argfile_default_contents, 0, "\n", "\r\n"); |
252 #endif | 254 #endif |
253 base::CreateDirectory(arg_file.DirName()); | 255 base::CreateDirectory(arg_file.DirName()); |
254 base::WriteFile(arg_file, argfile_default_contents.c_str(), | 256 base::WriteFile(arg_file, argfile_default_contents.c_str(), |
255 static_cast<int>(argfile_default_contents.size())); | 257 static_cast<int>(argfile_default_contents.size())); |
256 } | 258 } |
257 | 259 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 "Or see \"gn help args\" for more variants.").PrintToStdout(); | 338 "Or see \"gn help args\" for more variants.").PrintToStdout(); |
337 return 1; | 339 return 1; |
338 } | 340 } |
339 | 341 |
340 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) | 342 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kSwitchList)) |
341 return ListArgs(args[0]); | 343 return ListArgs(args[0]); |
342 return EditArgsFile(args[0]); | 344 return EditArgsFile(args[0]); |
343 } | 345 } |
344 | 346 |
345 } // namespace commands | 347 } // namespace commands |
OLD | NEW |