From 067f615443bcef47ac7dd7caa25a0419744f11ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas94@gmx.net>
Date: Wed, 4 Jan 2023 09:30:43 +0100
Subject: [PATCH] Path: allow deleting directories

---
 dependencies/filesystem/filesystem/path.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dependencies/filesystem/filesystem/path.h b/dependencies/filesystem/filesystem/path.h
index c339f34..72ed19b 100644
--- a/dependencies/filesystem/filesystem/path.h
+++ b/dependencies/filesystem/filesystem/path.h
@@ -321,11 +321,15 @@ public:
 		return os;
 	}
 
-	bool remove_file() {
+	bool remove_file() const {
 #if !defined(_WIN32)
 		return std::remove(str().c_str()) == 0;
 #else
-		return DeleteFileW(wstr().c_str()) != 0;
+		if (is_directory()) {
+			return RemoveDirectoryW(wstr().c_str()) != 0;
+		} else {
+			return DeleteFileW(wstr().c_str()) != 0;
+		}
 #endif
 	}
 
-- 
GitLab