From e5337be5bfdaacb771f6beffde984ce507d5722d Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Tue, 10 Nov 2020 12:21:10 -0500 Subject: [PATCH] make sure directory exists when creating log file --- src/core/context.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/context.cpp b/src/core/context.cpp index c752c5c..deeda38 100644 --- a/src/core/context.cpp +++ b/src/core/context.cpp @@ -185,7 +185,11 @@ bool context::enabled(level lv) void context::set_log_file(const fs::path& p) { - if (!p.empty()) + // creating directory + if (!exists(p.parent_path())) + op::create_directories(gcx(), paths::prefix()); + + if (!conf::dry() && !p.empty()) { HANDLE h = CreateFileW( p.native().c_str(), GENERIC_WRITE, FILE_SHARE_READ,