diff --git a/scripts/build.macos.release.sh b/scripts/build.macos.release.sh index c00ce77..f97b6cc 100644 --- a/scripts/build.macos.release.sh +++ b/scripts/build.macos.release.sh @@ -41,7 +41,7 @@ sudo install -d /usr/local/include/date/ sudo install -m644 libcron/externals/date/include/date/* /usr/local/include/date/ cd .. -git clone https://github.com/ToruNiina/toml11 --depth=1 +git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1 cd toml11 cmake -DCMAKE_CXX_STANDARD=11 . sudo make install -j6 > /dev/null diff --git a/scripts/build.windows.release.sh b/scripts/build.windows.release.sh index cc835cc..5c7b5c7 100644 --- a/scripts/build.windows.release.sh +++ b/scripts/build.windows.release.sh @@ -38,7 +38,7 @@ cmake -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD make install -j4 cd .. -git clone https://github.com/ToruNiina/toml11 --depth=1 +git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1 cd toml11 cmake -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=11 . make install -j4 diff --git a/src/handler/settings.cpp b/src/handler/settings.cpp index 655f5fd..d630c5c 100644 --- a/src/handler/settings.cpp +++ b/src/handler/settings.cpp @@ -1,6 +1,5 @@ #include #include -#include #include "config/binding.h" #include "handler/webget.h" @@ -565,12 +564,12 @@ void readYAMLConf(YAML::Node &node) writeLog(0, "Load preference settings in YAML format completed.", LOG_LEVEL_INFO); } -template -void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args) -{ - if(v.contains(k)) target = toml::find(v, k); - if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward(args)...); -} +//template +//void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args) +//{ +// if(v.contains(k)) target = toml::find(v, k); +// if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward(args)...); +//} void operate_toml_kv_table(const std::vector &arr, const toml::key &key_name, const toml::key &value_name, std::function binary_op) { diff --git a/src/handler/settings.h b/src/handler/settings.h index 495adab..cc2d698 100644 --- a/src/handler/settings.h +++ b/src/handler/settings.h @@ -13,6 +13,7 @@ #include "utils/string.h" #include "utils/stl_extra.h" #include "utils/tribool.h" +#include struct Settings { @@ -100,7 +101,12 @@ extern Settings global; int importItems(string_array &target, bool scope_limit = true); int loadExternalConfig(std::string &path, ExternalConfig &ext); - +template +void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args) +{ + if(v.contains(k)) target = toml::find(v, k); + if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward(args)...); +} template void parseGroupTimes(const std::string &src, Args... args) {