mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
robustify find_on_searchpath a bit
This commit is contained in:
parent
48c0d216f1
commit
8d7adf5f5c
@ -120,6 +120,16 @@ DSearchPath(const string &path, const string &separator) {
|
||||
append_path(path, separator);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DSearchPath::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
DSearchPath::
|
||||
DSearchPath(const Filename &directory) {
|
||||
append_directory(directory);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: DSearchPath::Copy Constructor
|
||||
// Access: Public
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
PUBLISHED:
|
||||
DSearchPath();
|
||||
DSearchPath(const string &path, const string &separator = string());
|
||||
DSearchPath(const Filename &directory);
|
||||
DSearchPath(const DSearchPath ©);
|
||||
void operator = (const DSearchPath ©);
|
||||
~DSearchPath();
|
||||
|
@ -741,7 +741,11 @@ standardize() {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void Filename::
|
||||
make_absolute() {
|
||||
make_absolute(ExecutionEnvironment::get_cwd());
|
||||
if (is_local()) {
|
||||
make_absolute(ExecutionEnvironment::get_cwd());
|
||||
} else {
|
||||
standardize();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -1266,7 +1270,9 @@ find_on_searchpath(const DSearchPath &searchpath) {
|
||||
|
||||
int num_directories = searchpath.get_num_directories();
|
||||
for (int i = 0; i < num_directories; i++) {
|
||||
if (make_relative_to(searchpath.get_directory(i), false)) {
|
||||
Filename directory = searchpath.get_directory(i);
|
||||
directory.make_absolute();
|
||||
if (make_relative_to(directory, false)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user