blob: bfd58db601ca61dd9c449fdf39de636991c01c87 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "../include.h"
#include "io.h"
std::mutex io::file_mutex;
bool io::read_file(const std::string_view path, std::vector<char>& out) {
std::ifstream file(path.data(), std::ios::binary);
if (!file.good()) {
log_error("{} isnt valid.", path);
return false;
}
file.unsetf(std::ios::skipws);
file.seekg(0, std::ios::end);
const size_t size = file.tellg();
file.seekg(0, std::ios::beg);
out.resize(size);
file.read(&out[0], size);
file.close();
return true;
}
|