#include "assets/data_loaders/glsl_loader.hpp" #include std::error_code glsl_loader::load( const std::filesystem::path& filename, std::string& source ) { auto file = std::ifstream(filename); if (not file.is_open()) { return std::make_error_code(std::errc::no_such_file_or_directory); } file.seekg(0, std::ios::end); const auto size = file.tellg(); if (size == 0 or size == std::numeric_limits::max()) { return std::make_error_code(std::errc::invalid_seek); } source.reserve(size); file.seekg(0, std::ios::beg); source.assign( std::istreambuf_iterator(file), std::istreambuf_iterator() ); file.close(); return {}; }