| 581 | } |
| 582 | |
| 583 | void PluginManager::load_plugin_version_cache_file(const String &cache_file, bool p_static_cached) { |
| 584 | // this works with both the static and dynamic cache files |
| 585 | auto file = FileAccess::open(cache_file, FileAccess::READ); |
| 586 | if (file.is_null()) { |
| 587 | ERR_PRINT("Failed to open plugin version cache file!"); |
| 588 | return; |
| 589 | } |
| 590 | |
| 591 | String json = file->get_as_text(); |
| 592 | Dictionary data = JSON::parse_string(json); |
| 593 | |
| 594 | MutexLock lock(plugin_version_cache_mutex); |
| 595 | for (auto &E : data.keys()) { |
| 596 | Dictionary version_data = data[E]; |
| 597 | PluginVersion version = PluginVersion::from_json(version_data); |
| 598 | if (version.is_valid()) { |
| 599 | version.is_static_cached = p_static_cached; |
| 600 | String cache_key = version.release_info.get_cache_key(); |
| 601 | plugin_version_cache[cache_key] = version; |
| 602 | } |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | void PluginManager::save_plugin_version_cache() { |
| 607 | String cache_dir = get_plugin_cache_path().path_join("plugin_versions"); |
nothing calls this directly
no test coverage detected