修复问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "MLAT.h"
|
||||
#include <fstream>
|
||||
#include <string_view>
|
||||
#include <tuple>
|
||||
#include "Global.h"
|
||||
time_t datetime_to_timestamp(std::string_view datetime) {
|
||||
std::tm tm = {};
|
||||
@@ -98,21 +99,20 @@ void read(MLAT_Data* buf, std::uint16_t* len) {
|
||||
MLAT_Config::MLAT_Config() {
|
||||
}
|
||||
void MLAT_Config::from_json(const Psc::JSON* that_json, bool not_exist_use_default_value) {
|
||||
auto value = settings.snapshot();
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
settings.write([&](auto& target) {
|
||||
target = value;
|
||||
const auto [enable, library_path, function_name] = settings.write([&](auto& value) {
|
||||
value.from_base_json(that_json, not_exist_use_default_value);
|
||||
return std::tuple{value.enable, value.library_path, value.function_name};
|
||||
});
|
||||
if (value.enable) {
|
||||
if (enable) {
|
||||
{
|
||||
auto r = Psc::try_load_library(Psc::get_abs_path(value.library_path));
|
||||
auto r = Psc::try_load_library(Psc::get_abs_path(library_path));
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
lib = r.value();
|
||||
}
|
||||
{
|
||||
auto r = Psc::try_load_function(lib, value.function_name);
|
||||
auto r = Psc::try_load_function(lib, function_name);
|
||||
if (!r) {
|
||||
Psc::fail_fast();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user