mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
fix logfile issue
This commit is contained in:
parent
cfdc400bcb
commit
4b99d6a3f1
@ -37,6 +37,8 @@ using namespace std;
|
||||
extern ostream *nout_stream;
|
||||
#define nout (*nout_stream)
|
||||
|
||||
extern string global_root_dir;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// Gecko requires all these symbols to be defined for Windows.
|
||||
|
@ -61,7 +61,7 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16 mode,
|
||||
_tokens.push_back(token);
|
||||
}
|
||||
|
||||
_root_dir = find_root_dir(nout);
|
||||
_root_dir = global_root_dir;
|
||||
|
||||
_got_instance_url = false;
|
||||
_got_window = false;
|
||||
|
@ -24,6 +24,8 @@
|
||||
static ofstream logfile;
|
||||
ostream *nout_stream = &logfile;
|
||||
|
||||
string global_root_dir;
|
||||
|
||||
NPNetscapeFuncs *browser;
|
||||
|
||||
static bool logfile_is_open = false;
|
||||
@ -46,7 +48,7 @@ open_logfile() {
|
||||
#endif
|
||||
if (log_directory.empty()) {
|
||||
#ifdef _WIN32
|
||||
static const size_t buffer_size = 4096;
|
||||
static const size_t buffer_size = MAX_PATH;
|
||||
char buffer[buffer_size];
|
||||
if (GetTempPath(buffer_size, buffer) != 0) {
|
||||
log_directory = buffer;
|
||||
@ -56,6 +58,14 @@ open_logfile() {
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
// Ensure that the log directory ends with a slash.
|
||||
if (!log_directory.empty() && log_directory[log_directory.size() - 1] != '/') {
|
||||
#ifdef _WIN32
|
||||
if (log_directory[log_directory.size() - 1] != '\\')
|
||||
#endif
|
||||
log_directory += "/";
|
||||
}
|
||||
|
||||
// Construct the full logfile pathname.
|
||||
string log_pathname = log_directory;
|
||||
log_pathname += log_basename;
|
||||
@ -138,6 +148,7 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs,
|
||||
|
||||
open_logfile();
|
||||
nout << "initializing\n";
|
||||
global_root_dir = find_root_dir(nout);
|
||||
|
||||
nout << "browserFuncs = " << browserFuncs << "\n";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user