mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
Add files via upload
This commit is contained in:
parent
78a3f44113
commit
be7259ebc2
33
source/util/theme.cpp
Normal file
33
source/util/theme.cpp
Normal 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>();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user