diff --git a/direct/src/p3d/AppRunner.py b/direct/src/p3d/AppRunner.py index 06f3c90fc9..105fea4297 100644 --- a/direct/src/p3d/AppRunner.py +++ b/direct/src/p3d/AppRunner.py @@ -112,6 +112,9 @@ class AppRunner(DirectObject): # the instance starts up. self.rootDir = None + # The log directory. Also filled in when the instance starts. + self.logDirectory = None + # self.superMirrorUrl, if nonempty, is the "super mirror" URL # that should be contacted first before trying the actual # host. This is primarily used for "downloading" from a @@ -522,7 +525,7 @@ class AppRunner(DirectObject): needsResponse = False) self.deferredEvals = [] - def setInstanceInfo(self, rootDir, superMirrorUrl): + def setInstanceInfo(self, rootDir, logDirectory, superMirrorUrl): """ Called by the browser to set some global information about the instance. """ @@ -530,6 +533,13 @@ class AppRunner(DirectObject): # machine. self.rootDir = Filename.fromOsSpecific(rootDir) + # logDirectory is the directory name where all log files end + # up. + if logDirectory: + self.logDirectory = Filename.fromOsSpecific(logDirectory) + else: + self.logDirectory = Filename(rootDir, 'log') + # The "super mirror" URL, generally used only by panda3d.exe. self.superMirrorUrl = superMirrorUrl @@ -920,6 +930,7 @@ def dummyAppRunner(tokens = [], argv = None): rootDir = Filename(Filename.getHomeDirectory(), '.panda3d') appRunner.rootDir = rootDir + appRunner.logDirectory = Filename(rootDir, 'log') # Of course we will have the panda3d application loaded. appRunner.addPackageInfo('panda3d', platform, version, hostUrl) diff --git a/direct/src/plugin/p3dPythonRun.cxx b/direct/src/plugin/p3dPythonRun.cxx index 294560d0c5..4633e17531 100755 --- a/direct/src/plugin/p3dPythonRun.cxx +++ b/direct/src/plugin/p3dPythonRun.cxx @@ -1195,13 +1195,19 @@ set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) { root_dir = ""; } + const char *log_directory = xinstance->Attribute("log_directory"); + if (log_directory == NULL) { + log_directory = ""; + } + const char *super_mirror = xinstance->Attribute("super_mirror"); if (super_mirror == NULL) { super_mirror = ""; } PyObject *result = PyObject_CallMethod - (_runner, (char *)"setInstanceInfo", (char *)"ss", root_dir, super_mirror); + (_runner, (char *)"setInstanceInfo", (char *)"sss", root_dir, + log_directory, super_mirror); if (result == NULL) { PyErr_Print();