Merge pull request #104014 from precup/relative_path_fix
Account for relative extends paths in a GDScript utility function
This commit is contained in:
@@ -2758,15 +2758,19 @@ String GDScriptLanguage::_get_global_class_name(const String &p_path, String *r_
|
||||
while (subclass) {
|
||||
if (subclass->extends_used) {
|
||||
if (!subclass->extends_path.is_empty()) {
|
||||
String subpath = subclass->extends_path;
|
||||
if (subpath.is_relative_path()) {
|
||||
subpath = path.get_base_dir().path_join(subpath).simplify_path();
|
||||
}
|
||||
if (subclass->extends.is_empty()) {
|
||||
// We only care about the referenced class_name.
|
||||
_ALLOW_DISCARD_ _get_global_class_name(subclass->extends_path, r_base_type, nullptr, nullptr, nullptr, r_visited);
|
||||
_ALLOW_DISCARD_ _get_global_class_name(subpath, r_base_type, nullptr, nullptr, nullptr, r_visited);
|
||||
subclass = nullptr;
|
||||
break;
|
||||
} else {
|
||||
Vector<GDScriptParser::IdentifierNode *> extend_classes = subclass->extends;
|
||||
|
||||
Ref<FileAccess> subfile = FileAccess::open(subclass->extends_path, FileAccess::READ);
|
||||
Ref<FileAccess> subfile = FileAccess::open(subpath, FileAccess::READ);
|
||||
if (subfile.is_null()) {
|
||||
break;
|
||||
}
|
||||
@@ -2775,10 +2779,6 @@ String GDScriptLanguage::_get_global_class_name(const String &p_path, String *r_
|
||||
if (subsource.is_empty()) {
|
||||
break;
|
||||
}
|
||||
String subpath = subclass->extends_path;
|
||||
if (subpath.is_relative_path()) {
|
||||
subpath = path.get_base_dir().path_join(subpath).simplify_path();
|
||||
}
|
||||
|
||||
if (OK != subparser.parse(subsource, subpath, false)) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user