MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / get_release_info

Method get_release_info

plugin_manager/asset_library_source.cpp:182–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180} //namespace
181
182ReleaseInfo AssetLibrarySource::get_release_info(const String &plugin_name, int64_t primary_id, int64_t secondary_id, Error &r_connection_error) {
183 auto asset_id = primary_id;
184 auto edit_id = secondary_id;
185 if (asset_id <= 0 || edit_id <= 0) {
186 return ReleaseInfo();
187 }
188
189 Vector<Dictionary> edit_list;
190 r_connection_error = get_edit_list(asset_id, edit_list);
191 ERR_FAIL_COND_V_MSG(r_connection_error != OK, ReleaseInfo(), "Failed to get edit list for asset " + itos(asset_id));
192 for (const Dictionary &edit_list_entry : edit_list) {
193 if (int64_t(edit_list_entry.get("edit_id", {})) == edit_id) {
194 Dictionary edit_data;
195 r_connection_error = get_edit(edit_id, edit_data);
196 ERR_FAIL_COND_V_MSG(r_connection_error != OK, ReleaseInfo(), vformat("Failed to get edit %d for asset %d", edit_id, asset_id));
197 if (edit_data.is_empty()) {
198 continue;
199 }
200
201 String godot_version = edit_list_entry.get("godot_version", "");
202 String submit_date = edit_list_entry.get("submit_date", "");
203 String plugin_name_from_edit = edit_list_entry.get("title", "");
204 if (!is_empty_or_null(submit_date)) {
205 submit_date = submit_date.split(" ")[0];
206 }
207 String version = edit_data.get("version_string", "");
208 String download_commit = edit_data.get("download_commit", "");
209 if (is_empty_or_null(version) || is_empty_or_null(download_commit)) {
210 break;
211 }
212 if (!download_commit.begins_with("http")) {
213 String download_url = edit_data.get("download_url", "");
214 if (is_empty_or_null(download_url) || !download_url.begins_with("http")) {
215 break;
216 }
217 download_commit = download_url;
218 }
219 if (edit_data.has("godot_version")) {
220 String _ver = edit_data.get("godot_version", "");
221 if (!is_empty_or_null(_ver)) {
222 godot_version = _ver;
223 }
224 }
225 if (is_empty_or_null(godot_version)) {
226 WARN_PRINT("Godot version not found for plugin " + plugin_name_from_edit + " version: " + version);
227 }
228 String release_date = GODOT_VERSION_RELEASE_DATES.has(godot_version) ? GODOT_VERSION_RELEASE_DATES.get(godot_version) : "";
229 String current_version = godot_version;
230 if (is_empty_or_null(release_date)) {
231 print_line("Godot version " + godot_version + " not found in release dates");
232 } else {
233 if (submit_date < release_date) {
234 for (auto &E : GODOT_VERSION_RELEASE_DATES) {
235 const String &engine_version = E.key;
236 const String &date = E.value;
237 if (current_version[0] == engine_version[0] && date <= submit_date && current_version >= engine_version) {
238 godot_version = engine_version;
239 }

Callers

nothing calls this directly

Calls 5

ReleaseInfoClass · 0.85
get_plugin_nameFunction · 0.85
splitMethod · 0.80
is_empty_or_nullFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected