mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
*** empty log message ***
This commit is contained in:
parent
b8aaaf95a8
commit
f075f7311d
@ -35,11 +35,18 @@
|
|||||||
#include <orthoProjection.h>
|
#include <orthoProjection.h>
|
||||||
#include <appTraverser.h>
|
#include <appTraverser.h>
|
||||||
#include <collisionTraverser.h>
|
#include <collisionTraverser.h>
|
||||||
|
#include <get_config_path.h>
|
||||||
|
|
||||||
ConfigureDef(config_showbase);
|
ConfigureDef(config_showbase);
|
||||||
ConfigureFn(config_showbase) {
|
ConfigureFn(config_showbase) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DSearchPath &
|
||||||
|
get_particle_path() {
|
||||||
|
static DSearchPath *particle_path = NULL;
|
||||||
|
return get_config_path("particle-path", particle_path);
|
||||||
|
}
|
||||||
|
|
||||||
static CollisionTraverser *collision_traverser = NULL;
|
static CollisionTraverser *collision_traverser = NULL;
|
||||||
|
|
||||||
// Default channel config
|
// Default channel config
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <pointerTo.h>
|
#include <pointerTo.h>
|
||||||
#include <nodePath.h>
|
#include <nodePath.h>
|
||||||
#include <dconfig.h>
|
#include <dconfig.h>
|
||||||
|
#include <dSearchPath.h>
|
||||||
|
|
||||||
ConfigureDecl(config_showbase, EXPCL_DIRECT, EXPTP_DIRECT);
|
ConfigureDecl(config_showbase, EXPCL_DIRECT, EXPTP_DIRECT);
|
||||||
typedef Config::Config<ConfigureGetConfig_config_showbase> ConfigShowbase;
|
typedef Config::Config<ConfigureGetConfig_config_showbase> ConfigShowbase;
|
||||||
@ -25,6 +26,8 @@ class Camera;
|
|||||||
|
|
||||||
BEGIN_PUBLISH
|
BEGIN_PUBLISH
|
||||||
|
|
||||||
|
EXPCL_DIRECT DSearchPath &get_particle_path();
|
||||||
|
|
||||||
EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe();
|
EXPCL_DIRECT PT(GraphicsPipe) make_graphics_pipe();
|
||||||
EXPCL_DIRECT PT(GraphicsWindow)
|
EXPCL_DIRECT PT(GraphicsWindow)
|
||||||
make_graphics_window(GraphicsPipe *pipe,
|
make_graphics_window(GraphicsPipe *pipe,
|
||||||
|
@ -53,6 +53,66 @@ ExecutionEnvironment() {
|
|||||||
read_args();
|
read_args();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ExecutionEnviroment::expand_string
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Reads the string, looking for environment variable
|
||||||
|
// names marked by a $. Expands all such variable
|
||||||
|
// names. A repeated dollar sign ($$) is mapped to a
|
||||||
|
// single dollar sign.
|
||||||
|
//
|
||||||
|
// Returns the expanded string.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
string ExecutionEnvironment::
|
||||||
|
expand_string(const string &str) {
|
||||||
|
string result;
|
||||||
|
|
||||||
|
size_t last = 0;
|
||||||
|
size_t dollar = str.find('$');
|
||||||
|
while (dollar != string::npos && dollar + 1 < str.length()) {
|
||||||
|
size_t start = dollar + 1;
|
||||||
|
|
||||||
|
if (str[start] == '$') {
|
||||||
|
// A double dollar sign maps to a single dollar sign.
|
||||||
|
result += str.substr(last, start - last);
|
||||||
|
last = start + 1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
string varname;
|
||||||
|
size_t end = start;
|
||||||
|
|
||||||
|
if (str[start] == '{') {
|
||||||
|
// Curly braces delimit the variable name explicitly.
|
||||||
|
end = str.find('}', start + 1);
|
||||||
|
if (end != string::npos) {
|
||||||
|
varname = str.substr(start + 1, end - (start + 1));
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end == start) {
|
||||||
|
// Scan for the end of the variable name.
|
||||||
|
while (end < str.length() && (isalnum(str[end]) || str[end] == '_')) {
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
varname = str.substr(start, end - start);
|
||||||
|
}
|
||||||
|
|
||||||
|
string subst =
|
||||||
|
result += str.substr(last, dollar - last);
|
||||||
|
result += get_environment_variable(varname);
|
||||||
|
last = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
dollar = str.find('$', last);
|
||||||
|
}
|
||||||
|
|
||||||
|
result += str.substr(last);
|
||||||
|
|
||||||
|
cerr << "Expanding " << str << " to " << result << "\n";
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: ExecutionEnviroment::get_cwd
|
// Function: ExecutionEnviroment::get_cwd
|
||||||
// Access: Public, Static
|
// Access: Public, Static
|
||||||
|
@ -29,6 +29,8 @@ public:
|
|||||||
INLINE static bool has_environment_variable(const string &var);
|
INLINE static bool has_environment_variable(const string &var);
|
||||||
INLINE static string get_environment_variable(const string &var);
|
INLINE static string get_environment_variable(const string &var);
|
||||||
|
|
||||||
|
static string expand_string(const string &str);
|
||||||
|
|
||||||
INLINE static int get_num_args();
|
INLINE static int get_num_args();
|
||||||
INLINE static string get_arg(int n);
|
INLINE static string get_arg(int n);
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "get_config_path.h"
|
#include "get_config_path.h"
|
||||||
#include "config_express.h"
|
#include "config_express.h"
|
||||||
|
|
||||||
|
#include <executionEnvironment.h>
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: get_config_path
|
// Function: get_config_path
|
||||||
@ -35,10 +37,10 @@ get_config_path(const string &config_var_name, DSearchPath *&static_ptr) {
|
|||||||
if (!all_defs.empty()) {
|
if (!all_defs.empty()) {
|
||||||
Config::ConfigTable::Symbol::reverse_iterator si =
|
Config::ConfigTable::Symbol::reverse_iterator si =
|
||||||
all_defs.rbegin();
|
all_defs.rbegin();
|
||||||
(*static_ptr).append_path((*si).Val());
|
(*static_ptr).append_path(ExecutionEnvironment::expand_string((*si).Val()));
|
||||||
++si;
|
++si;
|
||||||
while (si != all_defs.rend()) {
|
while (si != all_defs.rend()) {
|
||||||
(*static_ptr).append_path((*si).Val());
|
(*static_ptr).append_path(ExecutionEnvironment::expand_string((*si).Val()));
|
||||||
++si;
|
++si;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user