Skip to content

Commit

Permalink
fix: fix default config load
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Apr 13, 2024
1 parent d05cc1d commit bc3d94a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ll/api/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ bool defaultConfigUpdater(T& config, J& data) {
template <IsConfig T, class J = nlohmann::ordered_json, class F = bool(T&, J&)>
inline bool loadConfig(T& config, std::filesystem::path const& path, F&& updater = defaultConfigUpdater<T, J>) {
bool noNeedRewrite = true;
auto content = file_utils::readFile(path);
namespace fs = std::filesystem;
if (!fs::exists(path)) {
saveConfig<T, J>(config, path);
}
auto content = file_utils::readFile(path);
if (content && !content->empty()) {
auto data{J::parse(*content, nullptr, true, true)};
if (!data.contains("version")) {
Expand Down

0 comments on commit bc3d94a

Please sign in to comment.