mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Clean up server-side translations, remove global variable (#10075)
This commit is contained in:
parent
c8303f790c
commit
9ec75d7765
9 changed files with 50 additions and 65 deletions
|
@ -750,6 +750,21 @@ bool safeWriteToFile(const std::string &path, const std::string &content)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ReadFile(const std::string &path, std::string &out)
|
||||
{
|
||||
std::ifstream is(path, std::ios::binary | std::ios::ate);
|
||||
if (!is.good()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto size = is.tellg();
|
||||
out.resize(size);
|
||||
is.seekg(0);
|
||||
is.read(&out[0], size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rename(const std::string &from, const std::string &to)
|
||||
{
|
||||
return rename(from.c_str(), to.c_str()) == 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue