Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #13454. Use File class so that utf8 paths understood #13455

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/openrct2/scripting/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# include "../Diagnostic.h"
# include "../OpenRCT2.h"
# include "../core/File.h"
# include "Duktape.hpp"

# include <algorithm>
Expand Down Expand Up @@ -101,16 +102,7 @@ void Plugin::Stop()

void Plugin::LoadCodeFromFile()
{
std::string code;
std::ifstream fs(_path);
if (fs.is_open())
{
fs.seekg(0, std::ios::end);
code.reserve(fs.tellg());
fs.seekg(0, std::ios::beg);
code.assign(std::istreambuf_iterator<char>(fs), std::istreambuf_iterator<char>());
}
_code = std::move(code);
_code = File::ReadAllText(_path);
}

static std::string TryGetString(const DukValue& value, const std::string& message)
Expand Down