mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
ircd::fs: Add a file sizing suite.
This commit is contained in:
parent
fbf07913f7
commit
27721860c2
2 changed files with 15 additions and 0 deletions
|
@ -82,6 +82,9 @@ namespace ircd::fs
|
|||
bool is_dir(const std::string &path);
|
||||
bool is_reg(const std::string &path);
|
||||
|
||||
size_t size(const std::string &path);
|
||||
size_t size(const string_view &path);
|
||||
|
||||
std::vector<std::string> ls(const std::string &path);
|
||||
std::vector<std::string> ls_recursive(const std::string &path);
|
||||
|
||||
|
|
12
ircd/fs.cc
12
ircd/fs.cc
|
@ -246,6 +246,18 @@ catch(const fs::filesystem_error &e)
|
|||
throw filesystem_error("%s", e.what());
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::fs::size(const string_view &path)
|
||||
{
|
||||
return ircd::fs::size(std::string{path});
|
||||
}
|
||||
|
||||
size_t
|
||||
ircd::fs::size(const std::string &path)
|
||||
{
|
||||
return fs::file_size(path);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::fs::is_reg(const std::string &path)
|
||||
try
|
||||
|
|
Loading…
Reference in a new issue