Order logic a little less weirdly.

This commit is contained in:
Michael Bayne
2017-11-17 13:57:46 -08:00
parent 9e95ef3ea2
commit 3b3e8be165
@@ -469,7 +469,37 @@ public abstract class Getdown extends Thread
Set<Resource> toDownload = new HashSet<>(); Set<Resource> toDownload = new HashSet<>();
_app.verifyResources(_progobs, alreadyValid, unpacked, _app.verifyResources(_progobs, alreadyValid, unpacked,
_toInstallResources, toDownload); _toInstallResources, toDownload);
if (toDownload.size() == 0) {
if (toDownload.size() > 0) {
// we have resources to download, also note them as to-be-installed
for (Resource r : toDownload) {
if (!_toInstallResources.contains(r)) {
_toInstallResources.add(r);
}
}
try {
// if any of our resources have already been marked valid this is not a
// first time install and we don't want to enable tracking
_enableTracking = (alreadyValid[0] == 0);
reportTrackingEvent("app_start", -1);
// redownload any that are corrupt or invalid...
log.info(toDownload.size() + " of " + _app.getAllActiveResources().size() +
" rsrcs require update (" + alreadyValid[0] + " assumed valid).");
setStep(Step.REDOWNLOAD_RESOURCES);
download(toDownload);
reportTrackingEvent("app_complete", -1);
} finally {
_enableTracking = false;
}
// now we'll loop back and try it all again
continue;
}
// if we were downloaded in full from another service (say, Steam), we may // if we were downloaded in full from another service (say, Steam), we may
// not have unpacked all of our resources yet // not have unpacked all of our resources yet
if (Boolean.getBoolean("check_unpacked")) { if (Boolean.getBoolean("check_unpacked")) {
@@ -483,8 +513,7 @@ public abstract class Getdown extends Thread
} }
if (version < aversion) { if (version < aversion) {
log.info("Performing unpack.", log.info("Performing unpack", "version", version, "aversion", aversion);
"version", version, "aversion", aversion);
setStep(Step.UNPACK); setStep(Step.UNPACK);
updateStatus("m.validating"); updateStatus("m.validating");
_app.unpackResources(_progobs, unpacked); _app.unpackResources(_progobs, unpacked);
@@ -517,34 +546,6 @@ public abstract class Getdown extends Thread
return; return;
} }
// we have resources to download, also note them as to-be-installed
for (Resource r : toDownload) {
if (!_toInstallResources.contains(r)) {
_toInstallResources.add(r);
}
}
try {
// if any of our resources have already been marked valid this is not a first
// time install and we don't want to enable tracking
_enableTracking = (alreadyValid[0] == 0);
reportTrackingEvent("app_start", -1);
// redownload any that are corrupt or invalid...
log.info(toDownload.size() + " of " + _app.getAllActiveResources().size() +
" rsrcs require update (" + alreadyValid[0] + " assumed valid).");
setStep(Step.REDOWNLOAD_RESOURCES);
download(toDownload);
reportTrackingEvent("app_complete", -1);
} finally {
_enableTracking = false;
}
// now we'll loop back and try it all again
}
log.warning("Pants! We couldn't get the job done."); log.warning("Pants! We couldn't get the job done.");
throw new IOException("m.unable_to_repair"); throw new IOException("m.unable_to_repair");