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:
parent
a25143b035
commit
9ea5eceb0e
2 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue