1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-01 06:45:35 +00:00
openmw/components/files/openfile.cpp
2022-09-15 14:14:52 +04:00

16 lines
516 B
C++

#include "openfile.hpp"
#include <cstring>
namespace Files
{
std::unique_ptr<boost::filesystem::ifstream> openBinaryInputFileStream(const std::string& path)
{
auto stream = std::make_unique<boost::filesystem::ifstream>(path, boost::filesystem::fstream::binary);
if (!stream->is_open())
throw std::runtime_error("Failed to open '" + path + "' for reading: " + std::strerror(errno));
stream->exceptions(boost::filesystem::fstream::badbit);
return stream;
}
}