mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
25 lines
479 B
C++
25 lines
479 B
C++
|
|
#define SATDUMP_DLL_EXPORT 1
|
||
|
|
#include "settings.h"
|
||
|
|
#include "logger.h"
|
||
|
|
#include <fstream>
|
||
|
|
|
||
|
|
SATDUMP_DLL nlohmann::json settings;
|
||
|
|
|
||
|
|
std::string settings_path;
|
||
|
|
|
||
|
|
void loadSettings(std::string path)
|
||
|
|
{
|
||
|
|
settings_path = path;
|
||
|
|
logger->info("Loading settings from file " + path);
|
||
|
|
|
||
|
|
std::ifstream istream(path);
|
||
|
|
istream >> settings;
|
||
|
|
istream.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
void saveSettings()
|
||
|
|
{
|
||
|
|
std::ofstream ostream(settings_path);
|
||
|
|
ostream << settings.dump(4);
|
||
|
|
ostream.close();
|
||
|
|
}
|