summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-06-09 19:04:50 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-06-09 19:04:50 +0300
commit6eaff227ecbdb9535db8852089994cc71b5c5d1f (patch)
treea66e706141afcbe2cf7347dfe869bac9b8aae62f /main/main.cpp
parent300748e52c03fd1761b716fc7eea2b9fb97b86f9 (diff)
downloadredot-engine-6eaff227ecbdb9535db8852089994cc71b5c5d1f.tar.gz
Fix "Resource file not found" error on editor start.
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/main/main.cpp b/main/main.cpp
index ef997e71a7..c77942dd7a 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2060,6 +2060,25 @@ error:
return exit_code;
}
+Error _parse_resource_dummy(void *p_data, VariantParser::Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str) {
+ VariantParser::Token token;
+ VariantParser::get_token(p_stream, token, line, r_err_str);
+ if (token.type != VariantParser::TK_NUMBER && token.type != VariantParser::TK_STRING) {
+ r_err_str = "Expected number (old style sub-resource index) or String (ext-resource ID)";
+ return ERR_PARSE_ERROR;
+ }
+
+ r_res.unref();
+
+ VariantParser::get_token(p_stream, token, line, r_err_str);
+ if (token.type != VariantParser::TK_PARENTHESIS_CLOSE) {
+ r_err_str = "Expected ')'";
+ return ERR_PARSE_ERROR;
+ }
+
+ return OK;
+}
+
Error Main::setup2() {
Thread::make_main_thread(); // Make whatever thread call this the main thread.
set_current_thread_safe_for_nodes(true);
@@ -2107,12 +2126,16 @@ Error Main::setup2() {
int lines = 0;
String error_text;
+ VariantParser::ResourceParser rp_new;
+ rp_new.ext_func = _parse_resource_dummy;
+ rp_new.sub_func = _parse_resource_dummy;
+
while (true) {
assign = Variant();
next_tag.fields.clear();
next_tag.name = String();
- err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, nullptr, true);
+ err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, &rp_new, true);
if (err == ERR_FILE_EOF) {
break;
}