#include "openfile.hpp" #include #include #if defined(_WIN32) || defined(__WINDOWS__) #include #endif namespace Files { std::unique_ptr openBinaryInputFileStream(const std::string& path) { #if defined(_WIN32) || defined(__WINDOWS__) std::wstring wpath = boost::locale::conv::utf_to_utf(path); auto stream = std::make_unique(wpath, std::ios::binary); #else auto stream = std::make_unique(path, std::ios::binary); #endif if (!stream->is_open()) throw std::runtime_error("Failed to open '" + path + "' for reading: " + std::strerror(errno)); stream->exceptions(std::ios::badbit); return stream; } }