Răsfoiți Sursa

allow panda3d -P from a background shell on mac

David Rose 16 ani în urmă
părinte
comite
87baa4aab4

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

@@ -16,6 +16,7 @@
 
 #include "p3dEmbed.h"
 #include "load_plugin.h"
+#include "find_root_dir.h"
 
 ////////////////////////////////////////////////////////////////////
 //     Function: P3DEmbed::Constructor
@@ -24,6 +25,9 @@
 ////////////////////////////////////////////////////////////////////
 P3DEmbed::
 P3DEmbed(bool console_environment) : Panda3DBase(console_environment) {
+  // Since the Pand3DBase constructor no longer assigns _root_dir, we
+  // have to do it here.
+  _root_dir = find_root_dir();
 }
 
 ////////////////////////////////////////////////////////////////////

+ 4 - 2
direct/src/plugin_standalone/panda3d.cxx

@@ -15,8 +15,7 @@
 #include "panda3d.h"
 #include "load_plugin.h"
 #include "p3d_plugin_config.h"
-
-//#include "panda3dBase.cxx"
+#include "find_root_dir.h"
 
 // We can include this header file to get the DTOOL_PLATFORM
 // definition, even though we don't link with dtool.
@@ -300,6 +299,9 @@ run_command_line(int argc, char *argv[]) {
 ////////////////////////////////////////////////////////////////////
 bool Panda3D::
 post_arg_processing() {
+  // Now is a good time to assign _root_dir.
+  _root_dir = find_root_dir();
+
   // Set host_url_prefix to end with a slash.
   _host_url_prefix = _host_url;
   if (!_host_url_prefix.empty() && _host_url_prefix[_host_url_prefix.length() - 1] != '/') {

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

@@ -44,7 +44,13 @@ Panda3DBase::
 Panda3DBase(bool console_environment) {
   _console_environment = console_environment;
 
-  _root_dir = find_root_dir();
+  // We can't assign _root_dir immediately, because it requires a
+  // low-level Mac call that will balk if we're not logged in to the
+  // console, which will prevent scripts from using "panda3d -P" to
+  // find the platform and whatnot.  Instead, we'll assign it after
+  // we've processed the command line.
+  //_root_dir = find_root_dir();
+
   _reporting_download = false;
   _enable_security = false;