Add files via upload

This commit is contained in:
mrdude2478 2023-09-29 03:41:08 +01:00 committed by GitHub
parent 78a3f44113
commit be7259ebc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

33
source/util/theme.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <iostream>
#include <switch.h>
#include <cstring>
#include <sstream>
#include <filesystem>
#include "util/theme.hpp"
#include "util/config.hpp"
namespace Theme {
json theme;
void Load() {
std::ifstream ifs2;
std::string ThemePath = inst::config::appDir + "/theme/theme.json";
if (std::filesystem::exists(ThemePath)) {
ifs2 = std::ifstream(ThemePath);
theme = json::parse(ifs2);
ifs2.close();
}
else {
std::cout << "[FAILED TO LOAD Theme FILE]" << std::endl;
return;
}
}
std::string ThemeEntry(std::string key) {
json j = GetRelativeJson(theme, key);
if (j == nullptr) {
return "Json object: " + key + " does not exist!";
}
return j.get<std::string>();
}
}