aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/file.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/file.cpp b/src/file.cpp
index c6a4ff4..165f36e 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -69,6 +69,14 @@ Handle open_file(const std::wstring& path, const CreateFileParams& params) {
return Handle{handle};
}
+void remove_file(const std::wstring& path) {
+ const auto ret = ::DeleteFileW(path.c_str());
+
+ if (!ret) {
+ throw error::windows(GetLastError(), "DeleteFileW");
+ }
+}
+
} // namespace
Handle File::open_r(const std::string& path) {
@@ -87,4 +95,12 @@ Handle File::open_w(const CanonicalPath& path) {
return open_file(to_system_path(path), CreateFileParams::write());
}
+void File::remove(const std::string& path) {
+ remove_file(to_system_path(path));
+}
+
+void File::remove(const CanonicalPath& path) {
+ remove_file(to_system_path(path));
+}
+
} // namespace winapi