Add filesystem header to select between std::filesystem and std::experimental::filesystem depending on system availability.

Commit amended by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
k1-801 2021-04-24 21:40:24 +04:00 committed by Adam Honse
parent 05d72ba96f
commit ad2cd89128
6 changed files with 33 additions and 21 deletions

View file

@ -4,9 +4,7 @@
#include <iostream>
#include "ResourceManager.h"
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#include "filesystem.h"
static const char* log_codes[] = {"CRITICAL", "ERROR", "Message", "Warning", "Notice", "[verbose]", "Debug"};
@ -77,13 +75,13 @@ void LogManager::configure(json config, const std::string &defaultDir)
/*-------------------------------------------------*\
| If the path is relative, use logs dir |
\*-------------------------------------------------*/
fs::path p = logname;
filesystem::path p = logname;
if(p.is_relative())
{
p = defaultDir + "logs/";
p.append(logname);
}
fs::create_directories(p.parent_path());
filesystem::create_directories(p.parent_path());
/*-------------------------------------------------*\
| Open the logfile |