Added support for unicode paths (filesystem::path approach)

This commit is contained in:
Dmitry K 2023-01-18 06:02:55 +00:00 committed by Adam Honse
parent 351515f025
commit b409b5f7cc
14 changed files with 143 additions and 104 deletions

View file

@ -46,7 +46,7 @@ unsigned int LogManager::getLoglevel()
}
}
void LogManager::configure(json config, const std::string &defaultDir)
void LogManager::configure(json config, const filesystem::path& defaultDir)
{
std::lock_guard<std::mutex> grd(entry_mutex);
@ -92,11 +92,10 @@ void LogManager::configure(json config, const std::string &defaultDir)
/*-------------------------------------------------*\
| If the path is relative, use logs dir |
\*-------------------------------------------------*/
filesystem::path p = logname;
filesystem::path p = filesystem::u8path(logname);
if(p.is_relative())
{
p = defaultDir + "logs/";
p.append(logname);
p = defaultDir / "logs" / logname;
}
filesystem::create_directories(p.parent_path());
@ -351,4 +350,4 @@ void LogManager::UnregisterDialogShowCallback(LogDialogShowCallback callback, vo
dialog_show_callback_args.erase(dialog_show_callback_args.begin() + idx);
}
}
}
}