mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2024-12-28 18:18:52 +00:00
19 lines
556 B
C++
19 lines
556 B
C++
#include "openfile.hpp"
|
|
#include "conversion.hpp"
|
|
|
|
#include <cstring>
|
|
#include <fstream>
|
|
|
|
namespace Files
|
|
{
|
|
std::unique_ptr<std::ifstream> openBinaryInputFileStream(const std::filesystem::path& path)
|
|
{
|
|
auto stream = std::make_unique<std::ifstream>(path, std::ios::binary);
|
|
if (!stream->is_open())
|
|
throw std::system_error(errno, std::generic_category(),
|
|
"Failed to open '" + Files::pathToUnicodeString(path) + "' for reading");
|
|
stream->exceptions(std::ios::badbit);
|
|
return stream;
|
|
}
|
|
}
|