mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 01:40:46 +08:00
style.项目、文件名统一化
This commit is contained in:
27
src/MeoAssistant/AbstractConfiger.cpp
Normal file
27
src/MeoAssistant/AbstractConfiger.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "AbstractConfiger.h"
|
||||
|
||||
#include <meojson/json.h>
|
||||
|
||||
#include "AsstUtils.hpp"
|
||||
|
||||
bool asst::AbstractConfiger::load(const std::string& filename)
|
||||
{
|
||||
std::string content = utils::load_file_without_bom(filename);
|
||||
|
||||
auto&& ret = json::parser::parse(content);
|
||||
if (!ret) {
|
||||
m_last_error = "json pasing error " + content;
|
||||
return false;
|
||||
}
|
||||
|
||||
json::value root = std::move(ret.value());
|
||||
|
||||
try {
|
||||
return parse(root);
|
||||
}
|
||||
catch (json::exception& e) {
|
||||
m_last_error = std::string("json field error ") + e.what();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user