Add has_extension() method to String

This commit is contained in:
kobewi
2025-08-08 17:56:19 +02:00
parent ca452113d4
commit a33ae0be0e
29 changed files with 46 additions and 48 deletions

View File

@@ -1466,7 +1466,7 @@ void ResourceFormatLoaderText::get_classes_used(const String &p_path, HashSet<St
}
String ResourceFormatLoaderText::get_resource_type(const String &p_path) const {
String ext = p_path.get_extension().to_lower();
const String ext = p_path.get_extension().to_lower();
if (ext == "tscn") {
return "PackedScene";
} else if (ext != "tres") {
@@ -1488,8 +1488,7 @@ String ResourceFormatLoaderText::get_resource_type(const String &p_path) const {
}
String ResourceFormatLoaderText::get_resource_script_class(const String &p_path) const {
String ext = p_path.get_extension().to_lower();
if (ext != "tres") {
if (!p_path.has_extension("tres")) {
return String();
}
@@ -1507,8 +1506,7 @@ String ResourceFormatLoaderText::get_resource_script_class(const String &p_path)
}
ResourceUID::ID ResourceFormatLoaderText::get_resource_uid(const String &p_path) const {
String ext = p_path.get_extension().to_lower();
const String ext = p_path.get_extension().to_lower();
if (ext != "tscn" && ext != "tres") {
return ResourceUID::INVALID_ID;
}