diff --git a/include/ircd/fs.h b/include/ircd/fs.h index b65e94764..8f8da5ff5 100644 --- a/include/ircd/fs.h +++ b/include/ircd/fs.h @@ -95,9 +95,11 @@ namespace ircd::fs // This suite of IO functions may yield your context. std::string read(const std::string &name); string_view read(const std::string &name, const mutable_raw_buffer &buf); + string_view read(const string_view &name, const mutable_raw_buffer &buf); bool write(const std::string &name, const const_raw_buffer &buf); bool append(const std::string &name, const const_raw_buffer &buf); bool overwrite(const std::string &name, const const_raw_buffer &buf); + bool overwrite(const string_view &name, const const_raw_buffer &buf); struct init; } diff --git a/ircd/fs.cc b/ircd/fs.cc index f1a77b0f0..e6f3ff024 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -64,6 +64,13 @@ ircd::fs::write(const std::string &path, return overwrite(path, buf); } +bool +ircd::fs::overwrite(const string_view &path, + const const_raw_buffer &buf) +{ + return overwrite(std::string{path}, buf); +} + bool ircd::fs::overwrite(const std::string &path, const const_raw_buffer &buf) @@ -159,6 +166,13 @@ ircd::fs::read(const std::string &path) } #endif +ircd::string_view +ircd::fs::read(const string_view &path, + const mutable_raw_buffer &buf) +{ + return ircd::fs::read(std::string{path}, buf); +} + ircd::string_view ircd::fs::read(const std::string &path, const mutable_raw_buffer &buf)