0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::fs: Add function to read file from local filesystem.

This commit is contained in:
Jason Volk 2017-08-23 14:56:52 -06:00
parent a25143b035
commit 9ea5eceb0e
2 changed files with 11 additions and 0 deletions

View file

@ -94,5 +94,7 @@ std::vector<std::string> ls_recursive(const std::string &path);
std::string cwd();
void chdir(const std::string &path);
std::string read(const std::string &name);
} // namespace fs
} // namespace ircd

View file

@ -60,6 +60,15 @@ std::array<ent, num_of<index>()> paths
} // namespace fs
} // namespace ircd
std::string
ircd::fs::read(const std::string &path)
{
std::ifstream file{path};
std::noskipws(file);
std::istream_iterator<char> b{file};
std::istream_iterator<char> e{};
return std::string{b, e};
}
void
ircd::fs::chdir(const std::string &path)