Read changelog with File class

This commit is contained in:
Michał Janiszewski
2026-03-22 17:44:37 +01:00
parent bb8c585908
commit bc6bfb6329
+2 -13
View File
@@ -7,13 +7,13 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include <fstream>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/windows/Windows.h>
#include <openrct2/Diagnostic.h>
#include <openrct2/OpenRCT2.h>
#include <openrct2/PlatformEnvironment.h>
#include <openrct2/Version.h>
#include <openrct2/core/File.h>
#include <openrct2/core/FileSystem.hpp>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/Drawing.h>
@@ -65,18 +65,7 @@ namespace OpenRCT2::Ui::Windows
{
auto& env = GetContext()->GetPlatformEnvironment();
auto path = env.GetFilePath(pathId);
auto fs = std::ifstream(fs::u8path(path), std::ios::in);
if (!fs.is_open())
{
throw std::runtime_error("Unable to open " + path);
}
fs.seekg(0, fs.end);
auto length = fs.tellg();
fs.seekg(0, fs.beg);
std::unique_ptr<char[]> buffer = std::make_unique<char[]>(length);
fs.read(buffer.get(), length);
auto result = std::string(buffer.get(), buffer.get() + length);
return result;
return File::ReadAllText(path);
}
/**