Merge pull request #59 from isanae/master

Make sure directory exists when creating log file
This commit is contained in:
isanae
2020-11-10 12:21:56 -05:00
committed by GitHub
+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,