mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
alt_host affects log name, prc name, start dir
This commit is contained in:
parent
1972536934
commit
426f96e66b
@ -95,7 +95,6 @@ P3DInstance(P3D_request_ready_func *func,
|
||||
|
||||
P3DInstanceManager *inst_mgr = P3DInstanceManager::get_global_ptr();
|
||||
_instance_id = inst_mgr->get_unique_id();
|
||||
_has_log_basename = false;
|
||||
_hidden = (_fparams.lookup_token_int("hidden") != 0);
|
||||
_matches_run_origin = true;
|
||||
_matches_script_origin = false;
|
||||
@ -1695,13 +1694,6 @@ scan_app_desc_file(TiXmlDocument *doc) {
|
||||
assert(_xpackage == NULL);
|
||||
_xpackage = (TiXmlElement *)xpackage->Clone();
|
||||
|
||||
const char *log_basename = _xpackage->Attribute("log_basename");
|
||||
_has_log_basename = false;
|
||||
if (log_basename != NULL) {
|
||||
_log_basename = log_basename;
|
||||
_has_log_basename = false;
|
||||
}
|
||||
|
||||
TiXmlElement *xconfig = _xpackage->FirstChildElement("config");
|
||||
if (xconfig != NULL) {
|
||||
int hidden = 0;
|
||||
@ -1711,6 +1703,21 @@ scan_app_desc_file(TiXmlDocument *doc) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *log_basename = xconfig->Attribute("log_basename");
|
||||
if (log_basename != NULL) {
|
||||
_log_basename = log_basename;
|
||||
}
|
||||
|
||||
const char *prc_name = xconfig->Attribute("prc_name");
|
||||
if (prc_name != NULL) {
|
||||
_prc_name = prc_name;
|
||||
}
|
||||
|
||||
const char *start_dir = xconfig->Attribute("start_dir");
|
||||
if (start_dir != NULL) {
|
||||
_start_dir = start_dir;
|
||||
}
|
||||
|
||||
const char *run_origin = xconfig->Attribute("run_origin");
|
||||
if (run_origin != NULL) {
|
||||
_matches_run_origin = check_matches_origin(run_origin);
|
||||
|
@ -251,7 +251,8 @@ private:
|
||||
int _instance_id;
|
||||
string _session_key;
|
||||
string _log_basename;
|
||||
bool _has_log_basename;
|
||||
string _prc_name;
|
||||
string _start_dir;
|
||||
bool _hidden;
|
||||
bool _matches_run_origin;
|
||||
bool _matches_script_origin;
|
||||
|
@ -60,7 +60,6 @@ P3DSession(P3DInstance *inst) {
|
||||
_keep_user_env = false;
|
||||
_failed = false;
|
||||
|
||||
_start_dir = inst_mgr->get_root_dir() + "/start";
|
||||
_p3dpython_one_process = false;
|
||||
_p3dpython_started = false;
|
||||
_p3dpython_running = false;
|
||||
@ -703,6 +702,29 @@ start_p3dpython(P3DInstance *inst) {
|
||||
_keep_user_env = true;
|
||||
}
|
||||
if (!_keep_user_env) {
|
||||
_start_dir = inst_mgr->get_root_dir() + "/start";
|
||||
|
||||
string start_dir = inst->get_fparams().lookup_token("start_dir");
|
||||
if (start_dir.empty()) {
|
||||
start_dir = inst->_start_dir;
|
||||
|
||||
if (!start_dir.empty()) {
|
||||
// If the start_dir is taken from the p3d file (and not from the
|
||||
// HTML tokens), then we also append the alt_host name to the
|
||||
// start_dir, so that each alt_host variant will run in a
|
||||
// different directory.
|
||||
string alt_host = inst->get_fparams().lookup_token("alt_host");
|
||||
if (!alt_host.empty()) {
|
||||
start_dir += "_";
|
||||
start_dir += alt_host;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!start_dir.empty()) {
|
||||
_start_dir += "/";
|
||||
_start_dir += start_dir;
|
||||
}
|
||||
|
||||
mkdir_complete(_start_dir, nout);
|
||||
}
|
||||
|
||||
@ -745,6 +767,21 @@ start_p3dpython(P3DInstance *inst) {
|
||||
string prc_path = prc_root + sep + search_path;
|
||||
|
||||
string prc_name = inst->get_fparams().lookup_token("prc_name");
|
||||
if (prc_name.empty()) {
|
||||
prc_name = inst->_prc_name;
|
||||
|
||||
if (!prc_name.empty()) {
|
||||
// If the prc_name is taken from the p3d file (and not from the
|
||||
// HTML tokens), then we also append the alt_host name to the
|
||||
// prc_name, so that each alt_host variant will run in a
|
||||
// different directory.
|
||||
string alt_host = inst->get_fparams().lookup_token("alt_host");
|
||||
if (!alt_host.empty()) {
|
||||
prc_name += "_";
|
||||
prc_name += alt_host;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!prc_name.empty()) {
|
||||
// Add the prc_name to the path too, even if this directory doesn't
|
||||
// actually exist.
|
||||
@ -945,17 +982,26 @@ start_p3dpython(P3DInstance *inst) {
|
||||
console_output = true;
|
||||
}
|
||||
|
||||
// Get the log filename from the p3d_info.xml file.
|
||||
string log_basename = inst->_log_basename;
|
||||
bool has_log_basename = inst->_has_log_basename;
|
||||
// Get the log filename from the HTML tokens, or from the
|
||||
// p3d_info.xml file.
|
||||
string log_basename = inst->get_fparams().lookup_token("log_basename");
|
||||
if (log_basename.empty()) {
|
||||
log_basename = inst->_log_basename;
|
||||
|
||||
// But we also let it be overridden by the tokens.
|
||||
if (inst->get_fparams().has_token("log_basename")) {
|
||||
log_basename = inst->get_fparams().lookup_token("log_basename");
|
||||
has_log_basename = true;
|
||||
if (!log_basename.empty()) {
|
||||
// If the log_basename is taken from the p3d file (and not from
|
||||
// the HTML tokens), then we also append the alt_host name to
|
||||
// the log_basename, so that each alt_host variant will run in a
|
||||
// different directory.
|
||||
string alt_host = inst->get_fparams().lookup_token("alt_host");
|
||||
if (!alt_host.empty()) {
|
||||
log_basename += "_";
|
||||
log_basename += alt_host;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_log_basename) {
|
||||
if (log_basename.empty()) {
|
||||
#ifdef P3D_PLUGIN_LOG_BASENAME3
|
||||
// No log_basename specified for the app; use the compiled-in
|
||||
// default.
|
||||
|
Loading…
x
Reference in New Issue
Block a user