mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
fix fullpath globs
This commit is contained in:
parent
af3861a402
commit
9db8ebaac7
@ -67,18 +67,25 @@ has_glob_characters() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int GlobPattern::
|
int GlobPattern::
|
||||||
match_files(vector_string &results, const Filename &cwd) {
|
match_files(vector_string &results, const Filename &cwd) {
|
||||||
string next_pattern, next_suffix;
|
string prefix, pattern, suffix;
|
||||||
|
|
||||||
size_t slash = _pattern.find('/');
|
string source = _pattern;
|
||||||
|
if (!source.empty() && source[0] == '/') {
|
||||||
|
// If the first character is a slash, that becomes the prefix.
|
||||||
|
prefix = "/";
|
||||||
|
source = source.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t slash = source.find('/');
|
||||||
if (slash == string::npos) {
|
if (slash == string::npos) {
|
||||||
next_pattern = _pattern;
|
pattern = source;
|
||||||
} else {
|
} else {
|
||||||
next_pattern = _pattern.substr(0, slash);
|
pattern = source.substr(0, slash);
|
||||||
next_suffix = _pattern.substr(slash + 1);
|
suffix = source.substr(slash + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobPattern next_glob(next_pattern);
|
GlobPattern glob(pattern);
|
||||||
return next_glob.r_match_files(Filename(), next_suffix, results, cwd);
|
return glob.r_match_files(prefix, suffix, results, cwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user