From abedc35642e52a0373d77f65de681de30f993935 Mon Sep 17 00:00:00 2001
From: Moe-hacker <moe-hacker@outlook.com>
Date: Sun, 22 Dec 2024 04:15:36 +0000
Subject: [PATCH] Auto create dir for config output

---
 src/ruri.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/ruri.c b/src/ruri.c
index c8461a9..e4234d1 100644
--- a/src/ruri.c
+++ b/src/ruri.c
@@ -1013,6 +1013,8 @@ static void parse_args(int argc, char **_Nonnull argv, struct RURI_CONTAINER *_N
 		}
 		unlink(output_path);
 		remove(output_path);
+		ruri_mkdirs(output_path, 0755);
+		rmdir(output_path);
 		int fd = open(output_path, O_CREAT | O_CLOEXEC | O_RDWR, S_IRUSR | S_IRGRP | S_IROTH | S_IWGRP | S_IWUSR | S_IWOTH);
 		if (fd < 0) {
 			ruri_error("{red}Error: failed to open output file QwQ\n");