#include #include #include #include #include namespace Io { std::vector FileReader::Read(const std::string& path) { const auto native = NativePath(path); std::error_code error; if (!std::filesystem::is_regular_file(native, error)) throw Domain::RelinkerException("Cannot open file: " + path); std::ifstream f(native, std::ios::binary | std::ios::ate); if (!f) throw Domain::RelinkerException("Cannot open file: " + path); const std::streamsize size = f.tellg(); if (size < 0) throw Domain::RelinkerException("Cannot read file: " + path); f.seekg(0); std::vector buf(static_cast(size)); if (!f.read(reinterpret_cast(buf.data()), size)) throw Domain::RelinkerException("Cannot read file: " + path); return buf; } }