feat: debug版本/release版本加DEBUG.txt load时重新加载tasks.json

This commit is contained in:
uye
2023-07-31 18:47:20 +08:00
parent 35a757bb2e
commit e167d5188c

View File

@@ -51,15 +51,19 @@ std::shared_ptr<asst::TaskInfo> asst::TaskData::get(std::string_view name)
return expand_task(name, get_raw(name)).value_or(nullptr);
}
#ifndef ASST_DEBUG
const bool forcedReloadResource = std::ifstream("DEBUG").good() || std::ifstream("DEBUG.txt").good();
#endif // !ASST_DEBUG
bool asst::TaskData::parse(const json::value& json)
{
LogTraceFunction;
#ifndef ASST_DEBUG
if (forcedReloadResource) {
m_all_tasks_info.clear();
}
#endif // !ASST_DEBUG
const auto& json_obj = json.as_object();
@@ -236,6 +240,7 @@ bool asst::TaskData::parse(const json::value& json)
}
if (!validity) return false;
}
m_all_tasks_info.clear();
#endif
return true;
}