Merge pull request #85 from Artelys/master

bugfix when getdown stopped after downloading before installing
This commit is contained in:
Michael Bayne
2017-06-29 09:29:12 -07:00
committed by GitHub
2 changed files with 6 additions and 2 deletions
@@ -1276,7 +1276,7 @@ public class Application
* @param unpacked a set to populate with unpacked resources. * @param unpacked a set to populate with unpacked resources.
*/ */
public List<Resource> verifyResources (ProgressObserver obs, int[] alreadyValid, public List<Resource> verifyResources (ProgressObserver obs, int[] alreadyValid,
Set<Resource> unpacked) throws InterruptedException Set<Resource> unpacked, List<Resource> toBeInstalled) throws InterruptedException
{ {
List<Resource> rsrcs = getAllActiveResources(); List<Resource> rsrcs = getAllActiveResources();
List<Resource> failures = new ArrayList<Resource>(); List<Resource> failures = new ArrayList<Resource>();
@@ -1306,6 +1306,10 @@ public class Application
try { try {
if (_digest.validateResource(rsrc, robs)) { if (_digest.validateResource(rsrc, robs)) {
//if the resource is valid but has no _local file, we add it to the resource to install
if (!rsrc.getLocal().exists() && rsrc.getLocalNew().exists() && !toBeInstalled.contains(rsrc)) {
toBeInstalled.add(rsrc);
}
// unpack this resource if appropriate // unpack this resource if appropriate
if (noUnpack || !rsrc.shouldUnpack()) { if (noUnpack || !rsrc.shouldUnpack()) {
// finally note that this resource is kosher // finally note that this resource is kosher
@@ -476,7 +476,7 @@ public abstract class Getdown extends Thread
// now verify our resources... // now verify our resources...
setStep(Step.VERIFY_RESOURCES); setStep(Step.VERIFY_RESOURCES);
setStatusAsync("m.validating", -1, -1L, false); setStatusAsync("m.validating", -1, -1L, false);
List<Resource> failures = _app.verifyResources(_progobs, alreadyValid, unpacked); List<Resource> failures = _app.verifyResources(_progobs, alreadyValid, unpacked, _toBeInstalledResouces);
if (failures == null) { if (failures == null) {
log.info("Resources verified."); log.info("Resources verified.");