mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2026-05-06 07:56:46 -04:00
Read changelog with File class
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user