diff options
author | rubenwardy <rw@rubenwardy.com> | 2020-09-16 14:51:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-16 14:51:11 +0100 |
commit | 9ec75d77651c333eca3c5b46a3a56c8353fed464 (patch) | |
tree | fb8d42716279514e8850e53e47973a0f6d0ef7d5 /src/filesys.cpp | |
parent | c8303f790ccb03857d031ecb73de7f9f59a6ceba (diff) | |
download | minetest-9ec75d77651c333eca3c5b46a3a56c8353fed464.tar.gz minetest-9ec75d77651c333eca3c5b46a3a56c8353fed464.tar.bz2 minetest-9ec75d77651c333eca3c5b46a3a56c8353fed464.zip |
Clean up server-side translations, remove global variable (#10075)
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r-- | src/filesys.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp index 0bc351669..2470b1b64 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -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; |