Elevate Engine
1
Loading...
Searching...
No Matches
FileUtility.cpp
Go to the documentation of this file.
1
#include "
eepch.h
"
2
#include "
FileUtility.h
"
3
4
#include <fstream>
5
#include <
ElevateEngine/Core/Log.h
>
6
#include <
ElevateEngine/Core/PathResolver.h
>
7
8
std::string
Elevate::File::GetFileContent
(std::string path)
9
{
10
std::string resolvedPath = PathResolver::Resolve(path);
11
12
std::string content;
13
std::ifstream s(resolvedPath, std::ios::in);
14
15
// If file does not exists
16
if
(!s.is_open())
17
{
18
EE_CORE_ERROR(
"Could not open file : {0}, file does not exist"
, resolvedPath);
19
return
std::string();
20
}
21
22
// Get all of the lines from the file
23
std::string line =
""
;
24
while
(!s.eof())
25
{
26
std::getline(s, line);
27
content.append(line +
"\n"
);
28
}
29
30
// Close the file (good practice)
31
s.close();
32
33
return
content;
34
}
FileUtility.h
Log.h
PathResolver.h
eepch.h
Elevate::File::GetFileContent
std::string GetFileContent(std::string path)
Definition
FileUtility.cpp:8
ElevateEngine
src
ElevateEngine
Files
FileUtility.cpp
Generated by
1.9.8