quick commit
This commit is contained in:
17
include/helpers/system.hpp
Normal file
17
include/helpers/system.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
|
||||
class SystemHelper {
|
||||
public:
|
||||
static std::string read_file_to_string(const std::string &filePath) {
|
||||
std::ifstream file(filePath);
|
||||
if (!file.is_open()) {
|
||||
throw std::runtime_error("Could not open file: " + filePath);
|
||||
}
|
||||
std::string content((std::istreambuf_iterator<char>(file)),
|
||||
std::istreambuf_iterator<char>());
|
||||
file.close();
|
||||
return content;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user