Auto temp logfile path

This commit is contained in:
rdb 2009-07-22 10:43:08 +00:00
parent 7177e3d43a
commit af7827c42a
3 changed files with 37 additions and 1 deletions

View File

@ -292,7 +292,24 @@ load_plugin(const string &p3d_plugin_filename) {
// Successfully loaded. // Successfully loaded.
plugin_loaded = true; plugin_loaded = true;
#ifdef P3D_PLUGIN_LOGFILE2
string logfilename = P3D_PLUGIN_LOGFILE2; string logfilename = P3D_PLUGIN_LOGFILE2;
#else
string logfilename;
#endif // P3D_PLUGIN_LOGFILE2
if (logfilename.empty()) {
#ifdef _WIN32
static const size_t buffer_size = 4096;
char buffer[buffer_size];
if (GetTempPath(buffer_size, buffer) != 0) {
logfilename = buffer;
logfilename += "panda3d.2.log";
}
#else
logfilename = "/tmp/panda3d.2.log";
#endif // _WIN32
}
if (!P3D_initialize(P3D_API_VERSION, logfilename.c_str())) { if (!P3D_initialize(P3D_API_VERSION, logfilename.c_str())) {
// Oops, failure to initialize. // Oops, failure to initialize.

View File

@ -347,6 +347,7 @@ subprocess_run() {
} }
_width = event.xconfigure.width; _width = event.xconfigure.width;
_height = event.xconfigure.height; _height = event.xconfigure.height;
override = true;
} }
double install_progress = _install_progress; double install_progress = _install_progress;

View File

@ -28,7 +28,25 @@ static bool logfile_is_open = false;
static void static void
open_logfile() { open_logfile() {
if (!logfile_is_open) { if (!logfile_is_open) {
logfile.open(P3D_PLUGIN_LOGFILE1); #ifdef P3D_PLUGIN_LOGFILE1
string logfilename = P3D_PLUGIN_LOGFILE1;
#else
string logfilename;
#endif // P3D_PLUGIN_LOGFILE1
if (logfilename.empty()) {
#ifdef _WIN32
static const size_t buffer_size = 4096;
char buffer[buffer_size];
if (GetTempPath(buffer_size, buffer) != 0) {
logfilename = buffer;
logfilename += "panda3d.1.log";
}
#else
logfilename = "/tmp/panda3d.1.log";
#endif // _WIN32
}
logfile.open(logfilename.c_str());
logfile_is_open = true; logfile_is_open = true;
} }
} }