make sure directory exists when creating log file

This commit is contained in:
isanae
2020-11-10 12:21:10 -05:00
parent bc6a3c3a69
commit e5337be5bf
+5 -1
View File
@@ -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,