Panda3D
Loading...
Searching...
No Matches
preprocess_argv.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file preprocess_argv.cxx
10 * @author drose
11 * @date 2011-11-08
12 */
13
14#include "preprocess_argv.h"
15#include "win32ArgParser.h"
16
17/**
18 * Processes the argc, argv pair as needed before passing it to getopt(). If
19 * this program is running on Windows, but not within Cygwin, this ignores the
20 * incoming argv, argv values, replacing them from the GetCommandLine()
21 * string, and expanding glob patterns like *.egg to a list of all matching
22 * egg files. On other platforms, this function does nothing and returns
23 * argc, argv unchanged.
24 *
25 * The argc and argv values are modified by this function, if necessary, to
26 * point to statically-allocated memory that will be valid until the next call
27 * to preprocess_argv().
28 */
29void
30preprocess_argv(int &argc, char **&argv) {
31#ifndef _WIN32
32 // Not Windows: do nothing.
33 (void) argc;
34 (void) argv;
35#else // _WIN32
36 // Temporarily commenting out to fix build. Revisit shortly.
37 static Win32ArgParser parser;
38 if (!parser.do_glob()) {
39 // No globbing required.
40 return;
41 }
42
43 // Globbing is required. Process the args.
44 parser.set_system_command_line();
45 argc = parser.get_argc();
46 argv = parser.get_argv();
47#endif // _WIN32
48}
void preprocess_argv(int &argc, char **&argv)
Processes the argc, argv pair as needed before passing it to getopt().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.