creating dirs

This commit is contained in:
leca 2024-10-05 15:03:17 +03:00
parent c01f6ba6c2
commit 61e052f22a
2 changed files with 8 additions and 0 deletions

View File

@ -6,10 +6,14 @@
#include <QApplication> #include <QApplication>
#include <curl/curl.h> #include <curl/curl.h>
#include <iostream> #include <iostream>
#include <filesystem>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser");
std::filesystem::create_directories(program_data_path);
std::string settings_file_path = std::string settings_file_path =
get_path_relative_to_home(".local/share/checks_parser/settings.json"); get_path_relative_to_home(".local/share/checks_parser/settings.json");

View File

@ -3,6 +3,7 @@
#include <fstream> #include <fstream>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
#include "../utils/utils.h"
Settings::Settings(std::string path) { Settings::Settings(std::string path) {
this->settings_file_path = path; this->settings_file_path = path;
@ -51,6 +52,9 @@ Settings::Settings(std::string path) {
nlohmann::json settings = nlohmann::json::parse(input); nlohmann::json settings = nlohmann::json::parse(input);
this->settings = settings; 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"]));
} }
void Settings::write_setting(std::string setting, std::string value) { void Settings::write_setting(std::string setting, std::string value) {