9 return std::filesystem::exists(m_filePath);
15 LOG_ERROR(
"Could not open file: %s", m_filePath.c_str());
19 std::ifstream file(m_filePath);
20 std::stringstream stream;
22 stream << file.rdbuf();
31 LOG_ERROR(
"Could not open file: %s", m_filePath.c_str());
35 std::ifstream file(m_filePath);
37 std::vector<std::string> buf_lines;
39 while (std::getline(file, line)) {
40 buf_lines.push_back(line);
49 LOG_ERROR(
"Could not open file: %s", m_filePath.c_str());
53 std::ifstream file(m_filePath, std::ios::binary);
54 file.seekg(0, std::ios::end);
55 u64 size = file.tellg();
56 file.seekg(0, std::ios::beg);
58 std::vector<u64> bytes(size);
60 file.read(
reinterpret_cast<char *
>(bytes.data()), size);
68 LOG_ERROR(
"Could not open file: %s", m_filePath.c_str());
72 std::ifstream file(m_filePath, std::ios::binary);
73 file.seekg(0, std::ios::end);
74 u64 size = file.tellg();
82 LOG_ERROR(
"Could not open file: %s", m_filePath.c_str());
Thin wrapper around std::ifstream for reading a single file.
#define LOG_ERROR(fmt,...)
std::vector< u64 > ReadToBytes()
Read the file as raw bytes.
std::string GetPath()
Return the path this reader was constructed with.
std::string ReadToString()
Read the entire file into a single string.
u64 GetSize()
Return the file size in bytes.
std::vector< std::string > ReadLines()
Read the file line-by-line.
bool Exists()
Check whether the file exists on disk.
uint64_t u64
Unsigned 64-bit integer.