From 269de98d220ede12f1affe0fa62f94b7cd85ac8b Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 26 Apr 2022 22:41:03 +0200 Subject: [PATCH] Resize the string in Directory::read_file(). --- core/os/directory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/os/directory.cpp b/core/os/directory.cpp index ca9478d..1714a92 100644 --- a/core/os/directory.cpp +++ b/core/os/directory.cpp @@ -122,6 +122,8 @@ String Directory::read_file(const String &path) { long fsize = ftell(f); fseek(f, 0, SEEK_SET); /* same as rewind(f); */ + fd.resize(fsize); + fread(fd.dataw(), 1, fsize, f); fclose(f);