From 9679c67904b4714e3f3166fbc7174347f1038bc4 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Mon, 25 Jul 2022 15:47:31 -0700 Subject: Address remaining scoped storage regressions - Accelerate common path used to check the storage scope for a given path - Update the logic for the `get_as_text()` method - previous logic loads the content of a text file one byte at a time --- core/core_bind.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'core') diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 26ecd41353..cb57cd7057 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1220,16 +1220,10 @@ Vector File::get_buffer(int64_t p_length) const { String File::get_as_text() const { ERR_FAIL_COND_V_MSG(f.is_null(), String(), "File must be opened before use, or is lacking read-write permission."); - String text; uint64_t original_pos = f->get_position(); const_cast(*f)->seek(0); - String l = get_line(); - while (!eof_reached()) { - text += l + "\n"; - l = get_line(); - } - text += l; + String text = f->get_as_utf8_string(); const_cast(*f)->seek(original_pos); -- cgit v1.2.3