Quellcode durchsuchen

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

rdb vor 15 Jahren
Ursprung
Commit
7e56fef6fc

+ 4 - 0
direct/src/plugin_standalone/p3dEmbed.cxx

@@ -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;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 5 - 1
direct/src/plugin_standalone/panda3dBase.cxx

@@ -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]);
   }

+ 1 - 0
direct/src/plugin_standalone/panda3dBase.h

@@ -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;