ensured building on ubuntu 18.04

This commit is contained in:
2024-12-01 18:53:16 +03:00
parent b59b42a40c
commit 88d849bee9
11 changed files with 194 additions and 252 deletions

View File

@@ -1,14 +1,21 @@
#include "settings.h"
#include <filesystem>
#include <fstream>
#include <nlohmann/json.hpp>
#include <string>
#include "../utils/utils.h"
#if __GNUC__ < 8
# include <experimental/filesystem>
using namespace std::experimental;
#else
# include <filesystem>
using std::filesystem;
#endif
Settings::Settings(std::string path) {
this->settings_file_path = path;
if (!std::filesystem::exists(path)) {
if (!filesystem::exists(path)) {
std::ofstream output(path);
nlohmann::json settings = R"({
@@ -53,8 +60,8 @@ Settings::Settings(std::string path) {
this->settings = settings;
}
std::filesystem::create_directories(get_path_relative_to_home(this->settings["ofds_modules_dir"]));
std::filesystem::create_directories(get_path_relative_to_home(this->settings["stores_modules_dir"]));
filesystem::create_directories(get_path_relative_to_home(this->settings["ofds_modules_dir"]));
filesystem::create_directories(get_path_relative_to_home(this->settings["stores_modules_dir"]));
}
void Settings::write_setting(std::string setting, std::string value) {