diff options
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 9bdc0aa4b..a2bf9c33c 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -34,7 +34,7 @@ namespace vcpkg::Files virtual std::vector<fs::path> get_files_non_recursive(const fs::path& dir) const = 0; virtual void write_lines(const fs::path& file_path, const std::vector<std::string>& lines) = 0; - virtual void write_contents(const fs::path& file_path, const std::string& data) = 0; + virtual void write_contents(const fs::path& file_path, const std::string& data, std::error_code& ec) = 0; virtual void rename(const fs::path& oldpath, const fs::path& newpath) = 0; virtual bool remove(const fs::path& path) = 0; virtual bool remove(const fs::path& path, std::error_code& ec) = 0; @@ -51,6 +51,14 @@ namespace vcpkg::Files fs::copy_options opts, std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; + + inline void write_contents(const fs::path& file_path, const std::string& data) + { + std::error_code ec; + write_contents(file_path, data, ec); + Checks::check_exit( + VCPKG_LINE_INFO, ec, "error while writing file: %s: %s", file_path.u8string(), ec.message()); + } }; Filesystem& get_real_filesystem(); |
