pass appRunner.logDirectory

This commit is contained in:
David Rose 2010-01-12 00:52:43 +00:00
parent b25d059474
commit a80a065d6d
2 changed files with 19 additions and 2 deletions

View File

@ -112,6 +112,9 @@ class AppRunner(DirectObject):
# the instance starts up. # the instance starts up.
self.rootDir = None 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 # self.superMirrorUrl, if nonempty, is the "super mirror" URL
# that should be contacted first before trying the actual # that should be contacted first before trying the actual
# host. This is primarily used for "downloading" from a # host. This is primarily used for "downloading" from a
@ -522,7 +525,7 @@ class AppRunner(DirectObject):
needsResponse = False) needsResponse = False)
self.deferredEvals = [] self.deferredEvals = []
def setInstanceInfo(self, rootDir, superMirrorUrl): def setInstanceInfo(self, rootDir, logDirectory, superMirrorUrl):
""" Called by the browser to set some global information about """ Called by the browser to set some global information about
the instance. """ the instance. """
@ -530,6 +533,13 @@ class AppRunner(DirectObject):
# machine. # machine.
self.rootDir = Filename.fromOsSpecific(rootDir) 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. # The "super mirror" URL, generally used only by panda3d.exe.
self.superMirrorUrl = superMirrorUrl self.superMirrorUrl = superMirrorUrl
@ -920,6 +930,7 @@ def dummyAppRunner(tokens = [], argv = None):
rootDir = Filename(Filename.getHomeDirectory(), '.panda3d') rootDir = Filename(Filename.getHomeDirectory(), '.panda3d')
appRunner.rootDir = rootDir appRunner.rootDir = rootDir
appRunner.logDirectory = Filename(rootDir, 'log')
# Of course we will have the panda3d application loaded. # Of course we will have the panda3d application loaded.
appRunner.addPackageInfo('panda3d', platform, version, hostUrl) appRunner.addPackageInfo('panda3d', platform, version, hostUrl)

View File

@ -1195,13 +1195,19 @@ set_instance_info(P3DCInstance *inst, TiXmlElement *xinstance) {
root_dir = ""; root_dir = "";
} }
const char *log_directory = xinstance->Attribute("log_directory");
if (log_directory == NULL) {
log_directory = "";
}
const char *super_mirror = xinstance->Attribute("super_mirror"); const char *super_mirror = xinstance->Attribute("super_mirror");
if (super_mirror == NULL) { if (super_mirror == NULL) {
super_mirror = ""; super_mirror = "";
} }
PyObject *result = PyObject_CallMethod 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) { if (result == NULL) {
PyErr_Print(); PyErr_Print();