Untested bugfix. Pdeployed executables were receiving incorrect command-line arguments

This commit is contained in:
rdb 2010-12-05 08:33:30 +00:00
parent 062e90a81a
commit 7e56fef6fc
3 changed files with 10 additions and 1 deletions

View File

@ -28,6 +28,10 @@ P3DEmbed(bool console_environment) : Panda3DBase(console_environment) {
// Since the Panda3DBase constructor no longer assigns _root_dir, we
// have to do it here.
_root_dir = find_root_dir();
// We should leave the arguments intact, just pass them
// 1:1 as we've received them.
_prepend_filename_to_args = false;
}
////////////////////////////////////////////////////////////////////

View File

@ -72,6 +72,8 @@ Panda3DBase(bool console_environment) {
// Seed the lame random number generator in rand(); we use it to
// select a mirror for downloading.
srand((unsigned int)time(NULL));
_prepend_filename_to_args = true;
}
////////////////////////////////////////////////////////////////////
@ -379,7 +381,9 @@ create_instance(const string &p3d, bool start_instance,
// Build up the argument list, beginning with the p3d_filename.
pvector<const char *> argv;
argv.push_back(os_p3d_filename.c_str());
if (_prepend_filename_to_args) {
argv.push_back(os_p3d_filename.c_str());
}
for (int i = 0; i < num_args; ++i) {
argv.push_back(args[i]);
}

View File

@ -89,6 +89,7 @@ protected:
bool _reporting_download;
bool _enable_security;
bool _console_environment;
bool _prepend_filename_to_args;
typedef pset<P3D_instance *> Instances;
Instances _instances;