1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

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

@@ -76,7 +76,7 @@ Error GDScriptParserRef::raise_status(Status p_new_status) {
get_parser()->clear();
status = PARSED;
String remapped_path = ResourceLoader::path_remap(path);
if (remapped_path.get_extension().to_lower() == "gdc") {
if (remapped_path.has_extension("gdc")) {
Vector<uint8_t> tokens = GDScriptCache::get_binary_tokens(remapped_path);
source_hash = hash_djb2_buffer(tokens.ptr(), tokens.size());
result = get_parser()->parse_binary(tokens, path);
@@ -313,7 +313,7 @@ Ref<GDScript> GDScriptCache::get_shallow_script(const String &p_path, Error &r_e
Ref<GDScript> script;
script.instantiate();
script->set_path(p_path, true);
if (remapped_path.get_extension().to_lower() == "gdc") {
if (remapped_path.has_extension("gdc")) {
Vector<uint8_t> buffer = get_binary_tokens(remapped_path);
if (buffer.is_empty()) {
r_error = ERR_FILE_CANT_READ;
@@ -364,7 +364,7 @@ Ref<GDScript> GDScriptCache::get_full_script(const String &p_path, Error &r_erro
const String remapped_path = ResourceLoader::path_remap(p_path);
if (p_update_from_disk) {
if (remapped_path.get_extension().to_lower() == "gdc") {
if (remapped_path.has_extension("gdc")) {
Vector<uint8_t> buffer = get_binary_tokens(remapped_path);
if (buffer.is_empty()) {
r_error = ERR_FILE_CANT_READ;