mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 01:44:06 -04:00
use <auto> filename path
This commit is contained in:
parent
c486e2b643
commit
1addfb29d8
@ -20,8 +20,10 @@
|
||||
|
||||
static Filename resolve_dso(const DSearchPath &path, const Filename &filename) {
|
||||
if (filename.is_local()) {
|
||||
if (path.is_empty()||
|
||||
((path.get_num_directories()==1)&&(path.get_directory(0)=="."))) {
|
||||
if ((path.get_num_directories()==1)&&(path.get_directory(0)=="<auto>")) {
|
||||
// This is a special case, meaning to search in the same
|
||||
// directory in which libp3dtool.dll, or the exe, was started
|
||||
// from.
|
||||
Filename dtoolpath = ExecutionEnvironment::get_dtool_name();
|
||||
DSearchPath spath(dtoolpath.get_dirname());
|
||||
return spath.find_file(filename);
|
||||
|
@ -30,6 +30,59 @@ ConfigVariableSearchPath(const string &name,
|
||||
#else
|
||||
ConfigVariableBase(name, VT_search_path, string(), flags),
|
||||
#endif
|
||||
_default_value(Filename(".")),
|
||||
_local_modified(initial_invalid_cache())
|
||||
{
|
||||
// A SearchPath variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
// complaining should anyone ask for its solitary value.
|
||||
if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
|
||||
_core->set_default_value("");
|
||||
}
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableSearchPath::
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
const DSearchPath &default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariableBase(name, VT_search_path, description, flags),
|
||||
#else
|
||||
ConfigVariableBase(name, VT_search_path, string(), flags),
|
||||
#endif
|
||||
_default_value(default_value),
|
||||
_local_modified(initial_invalid_cache())
|
||||
{
|
||||
// A SearchPath variable implicitly defines a default value of the empty
|
||||
// string. This is just to prevent the core variable from
|
||||
// complaining should anyone ask for its solitary value.
|
||||
if (_core->get_default_value() == (ConfigDeclaration *)NULL) {
|
||||
_core->set_default_value("");
|
||||
}
|
||||
_core->set_used();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::Constructor
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE ConfigVariableSearchPath::
|
||||
ConfigVariableSearchPath(const string &name,
|
||||
const string &default_value,
|
||||
const string &description, int flags) :
|
||||
#ifdef PRC_SAVE_DESCRIPTIONS
|
||||
ConfigVariableBase(name, VT_search_path, description, flags),
|
||||
#else
|
||||
ConfigVariableBase(name, VT_search_path, string(), flags),
|
||||
#endif
|
||||
_default_value(Filename(default_value)),
|
||||
_local_modified(initial_invalid_cache())
|
||||
{
|
||||
// A SearchPath variable implicitly defines a default value of the empty
|
||||
@ -74,6 +127,16 @@ get_value() const {
|
||||
return _cache;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::get_default_value
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const DSearchPath &ConfigVariableSearchPath::
|
||||
get_default_value() const {
|
||||
return _default_value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: ConfigVariableSearchPath::clear_local_value
|
||||
// Access: Published
|
||||
|
@ -46,10 +46,11 @@ reload_search_path() {
|
||||
_cache.append_directory(Filename::from_os_specific(expanded));
|
||||
}
|
||||
}
|
||||
_cache.append_path(_postfix);
|
||||
|
||||
if (_cache.is_empty()) {
|
||||
// An empty search path implicitly has "." on it.
|
||||
_cache.append_directory(".");
|
||||
if (num_unique_references == 0) {
|
||||
// An empty search path implicitly has the default value.
|
||||
_cache = _default_value;
|
||||
}
|
||||
|
||||
_cache.append_path(_postfix);
|
||||
}
|
||||
|
@ -48,10 +48,19 @@ PUBLISHED:
|
||||
INLINE ConfigVariableSearchPath(const string &name,
|
||||
const string &description = string(),
|
||||
int flags = 0);
|
||||
INLINE ConfigVariableSearchPath(const string &name,
|
||||
const DSearchPath &default_value,
|
||||
const string &description,
|
||||
int flags = 0);
|
||||
INLINE ConfigVariableSearchPath(const string &name,
|
||||
const string &default_value,
|
||||
const string &description,
|
||||
int flags = 0);
|
||||
INLINE ~ConfigVariableSearchPath();
|
||||
|
||||
INLINE operator const DSearchPath & () const;
|
||||
INLINE const DSearchPath &get_value() const;
|
||||
INLINE const DSearchPath &get_default_value() const;
|
||||
|
||||
INLINE bool clear_local_value();
|
||||
|
||||
@ -77,6 +86,7 @@ PUBLISHED:
|
||||
private:
|
||||
void reload_search_path();
|
||||
|
||||
DSearchPath _default_value;
|
||||
DSearchPath _prefix, _postfix;
|
||||
|
||||
AtomicAdjust::Integer _local_modified;
|
||||
|
Loading…
x
Reference in New Issue
Block a user