mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
Solve failed to generate rule set (#447)
* Fix: Cannot find geoip/geosite.db to compile rule set when application path not exist core asset file * Improve: avoid repeatedly get core assert path
This commit is contained in:
parent
44658c9053
commit
dffb2d34c1
@ -668,6 +668,8 @@ namespace NekoGui {
|
||||
}
|
||||
|
||||
auto ruleSetArray = QJsonArray();
|
||||
auto geoSitePath = GetCoreAssetDir("geosite.db");
|
||||
auto geoIpPath = GetCoreAssetDir("geoip.db");
|
||||
for (const auto &item: *neededRuleSets) {
|
||||
ruleSetArray += QJsonObject{
|
||||
{"type", "local"},
|
||||
@ -677,7 +679,13 @@ namespace NekoGui {
|
||||
};
|
||||
if (QFile(QString(RULE_SETS_DIR + "/%1.srs").arg(item)).exists()) continue;
|
||||
bool ok;
|
||||
auto err = NekoGui_rpc::defaultClient->CompileGeoSet(&ok, item.contains("_IP") ? NekoGui_rpc::GeoRuleSetType::ip : NekoGui_rpc::GeoRuleSetType::site, item.toStdString(), GetBasePath());
|
||||
auto mode = NekoGui_rpc::GeoRuleSetType::site;
|
||||
auto geoAssertPath = geoSitePath;
|
||||
if (item.contains("_IP")) {
|
||||
mode = NekoGui_rpc::GeoRuleSetType::ip;
|
||||
geoAssertPath = geoIpPath;
|
||||
}
|
||||
auto err = NekoGui_rpc::defaultClient->CompileGeoSet(&ok, mode, item.toStdString(), geoAssertPath);
|
||||
if (!ok) {
|
||||
MW_show_log("Failed to generate rule set asset for " + item);
|
||||
status->result->error = err;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user