mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
use CONFIGRC_DIR and DEFAULT_CONFIGRC_DIR
This commit is contained in:
parent
988a2e060c
commit
a11c7a4828
@ -98,6 +98,15 @@
|
|||||||
// #define INSTALL_LIB_DIR /usr/lib/python2.2/site-packages
|
// #define INSTALL_LIB_DIR /usr/lib/python2.2/site-packages
|
||||||
|
|
||||||
|
|
||||||
|
// The Configrc file is used by Panda for runtime configuration.
|
||||||
|
// Panda will look for it in the directory specified by the
|
||||||
|
// CONFIGRC_DIR environment variable, or in the directory named here
|
||||||
|
// if that environment variable is undefined. By default, we specify
|
||||||
|
// a dot, to indicate the current directory; you may redefine this if
|
||||||
|
// you have someplace in particular you'd rather put it.
|
||||||
|
#define DEFAULT_CONFIGRC_DIR .
|
||||||
|
|
||||||
|
|
||||||
// What level of compiler optimization/debug symbols should we build?
|
// What level of compiler optimization/debug symbols should we build?
|
||||||
// The various optimize levels are defined as follows:
|
// The various optimize levels are defined as follows:
|
||||||
//
|
//
|
||||||
|
@ -183,6 +183,14 @@ $[cdefine LINK_IN_GL]
|
|||||||
/* Define if we are linking PANDAPHYSICS in with PANDA. */
|
/* Define if we are linking PANDAPHYSICS in with PANDA. */
|
||||||
$[cdefine LINK_IN_PHYSICS]
|
$[cdefine LINK_IN_PHYSICS]
|
||||||
|
|
||||||
|
/* The compiled-in default directory to look for the Configrc file, in
|
||||||
|
the absence of the CONFIGRC_DIR environment variable set, and in
|
||||||
|
the absence of anything specified via the configpath directive. */
|
||||||
|
# define DEFAULT_CONFIGRC_DIR "$[DEFAULT_CONFIGRC_DIR]"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Define if your processor stores words with the most significant
|
/* Define if your processor stores words with the most significant
|
||||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||||
$[cdefine WORDS_BIGENDIAN]
|
$[cdefine WORDS_BIGENDIAN]
|
||||||
|
@ -141,17 +141,33 @@ void ConfigTable::ReadConfigFile() {
|
|||||||
int i = configpath.find_first_of(" ");
|
int i = configpath.find_first_of(" ");
|
||||||
ConfigString stmp = configpath.substr(0, i);
|
ConfigString stmp = configpath.substr(0, i);
|
||||||
if (ExecutionEnvironment::has_environment_variable(stmp)) {
|
if (ExecutionEnvironment::has_environment_variable(stmp)) {
|
||||||
Filename next_path = Filename::from_os_specific(ExecutionEnvironment::get_environment_variable(stmp));
|
string next_path = ExecutionEnvironment::get_environment_variable(stmp);
|
||||||
config_search.append_path(next_path);
|
|
||||||
|
while (!next_path.empty()) {
|
||||||
|
int j = next_path.find_first_of(" ");
|
||||||
|
Filename dir = Filename::from_os_specific(next_path.substr(0, j));
|
||||||
|
config_search.append_directory(dir);
|
||||||
|
next_path.erase(0, j);
|
||||||
|
CropString(next_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
configpath.erase(0, i);
|
configpath.erase(0, i);
|
||||||
CropString(configpath);
|
CropString(configpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the configpath is empty, use the configdir string instead. If
|
||||||
|
// the configdir string is empty, it gets its value from the
|
||||||
|
// CONFIGRC_DIR environment variable, or from the compiled-in
|
||||||
|
// default.
|
||||||
if (config_search.is_empty()) {
|
if (config_search.is_empty()) {
|
||||||
// If we still have no directories on the search path, then at
|
if (configdir.empty()) {
|
||||||
// least search the current directory.
|
configdir = ExecutionEnvironment::get_environment_variable("CONFIGRC_DIR");
|
||||||
config_search.append_directory(".");
|
if (configdir.empty()) {
|
||||||
|
configdir = DEFAULT_CONFIGRC_DIR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config_search.append_directory(Filename::from_os_specific(configdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (microconfig_cat->is_spam()) {
|
if (microconfig_cat->is_spam()) {
|
||||||
@ -361,6 +377,7 @@ void ConfigTable::MicroConfig() {
|
|||||||
bool csuff = false;
|
bool csuff = false;
|
||||||
bool cargs = false;
|
bool cargs = false;
|
||||||
bool cpath = false;
|
bool cpath = false;
|
||||||
|
bool cdir = false;
|
||||||
bool ccmt = false;
|
bool ccmt = false;
|
||||||
bool asuff = false;
|
bool asuff = false;
|
||||||
bool cstub = false;
|
bool cstub = false;
|
||||||
@ -467,6 +484,14 @@ void ConfigTable::MicroConfig() {
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
cpath = true;
|
cpath = true;
|
||||||
|
} else if (tok == "configdir") {
|
||||||
|
configdir = rest;
|
||||||
|
if (microconfig_cat->is_spam())
|
||||||
|
microconfig_cat->spam()
|
||||||
|
<< "got a microconfig configdir directive, "
|
||||||
|
<< "setting the configdir to '" << configdir << "'"
|
||||||
|
<< endl;
|
||||||
|
cdir = true;
|
||||||
} else if (tok == "configcmt") {
|
} else if (tok == "configcmt") {
|
||||||
configcmt = rest;
|
configcmt = rest;
|
||||||
ccmt = true;
|
ccmt = true;
|
||||||
@ -576,6 +601,13 @@ void ConfigTable::MicroConfig() {
|
|||||||
<< "setting to default '" << configpath
|
<< "setting to default '" << configpath
|
||||||
<< "'" << endl;
|
<< "'" << endl;
|
||||||
}
|
}
|
||||||
|
if (!cdir) {
|
||||||
|
ConfigPathDefault();
|
||||||
|
if (microconfig_cat->is_spam())
|
||||||
|
microconfig_cat->spam() << "no microconfig for configdir, "
|
||||||
|
<< "setting to default '" << configdir
|
||||||
|
<< "'" << endl;
|
||||||
|
}
|
||||||
if (!ccmt) {
|
if (!ccmt) {
|
||||||
ConfigCmtDefault();
|
ConfigCmtDefault();
|
||||||
if (microconfig_cat->is_spam())
|
if (microconfig_cat->is_spam())
|
||||||
|
@ -53,6 +53,7 @@ private:
|
|||||||
ConfigString configsuffix;
|
ConfigString configsuffix;
|
||||||
ConfigString configargs;
|
ConfigString configargs;
|
||||||
ConfigString configpath;
|
ConfigString configpath;
|
||||||
|
ConfigString configdir;
|
||||||
ConfigString configcmt;
|
ConfigString configcmt;
|
||||||
ConfigString argsuffix;
|
ConfigString argsuffix;
|
||||||
ConfigString commandstub;
|
ConfigString commandstub;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user