mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-25 04:11:42 -04:00
check if the github tag exists before downloading
This commit is contained in:
parent
1ae1f7df73
commit
991e714810
1 changed files with 26 additions and 4 deletions
|
@ -568,10 +568,32 @@ void Loader::Impl::updateSpecialFiles() {
|
|||
|
||||
void Loader::Impl::downloadLoaderResources(bool useLatestRelease) {
|
||||
if (!useLatestRelease) {
|
||||
this->tryDownloadLoaderResources(fmt::format(
|
||||
"https://github.com/geode-sdk/geode/releases/download/{}/resources.zip",
|
||||
this->getVersion().toString()
|
||||
), false);
|
||||
web::AsyncWebRequest()
|
||||
.join("loader-tag-exists-check")
|
||||
.fetch(fmt::format(
|
||||
"https://api.github.com/repos/geode-sdk/geode/git/ref/tags/{}",
|
||||
this->getVersion().toString()
|
||||
))
|
||||
.json()
|
||||
.then([this](json::Value const& json) {
|
||||
this->tryDownloadLoaderResources(fmt::format(
|
||||
"https://github.com/geode-sdk/geode/releases/download/{}/resources.zip",
|
||||
this->getVersion().toString()
|
||||
), true);
|
||||
})
|
||||
.expect([this](std::string const& info, int code) {
|
||||
if (code == 404) {
|
||||
log::debug("Loader version {} does not exist on Github, not downloading the resources", this->getVersion().toString());
|
||||
ResourceDownloadEvent(
|
||||
UpdateFinished()
|
||||
).post();
|
||||
}
|
||||
else {
|
||||
ResourceDownloadEvent(
|
||||
UpdateFailed("Unable to check if tag exists: " + info)
|
||||
).post();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
fetchLatestGithubRelease(
|
||||
|
|
Loading…
Add table
Reference in a new issue