From 27721860c28ddfc3d17c76be03adf3ec0348b3be Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 20 Dec 2017 17:33:12 -0700 Subject: [PATCH] ircd::fs: Add a file sizing suite. --- include/ircd/fs.h | 3 +++ ircd/fs.cc | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/ircd/fs.h b/include/ircd/fs.h index 732299ac0..b65e94764 100644 --- a/include/ircd/fs.h +++ b/include/ircd/fs.h @@ -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 ls(const std::string &path); std::vector ls_recursive(const std::string &path); diff --git a/ircd/fs.cc b/ircd/fs.cc index 470ce7d4c..f1a77b0f0 100644 --- a/ircd/fs.cc +++ b/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