Task <string> installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release, Action <int> progressCallback)
            {
                return(Task.Run(async() => {
                    var target = getDirectoryForRelease(release.Version);

                    // NB: This might happen if we got killed partially through applying the release
                    if (target.Exists)
                    {
                        this.Log().Warn("Found partially applied release folder, killing it: " + target.FullName);
                        await Utility.DeleteDirectory(target.FullName);
                    }

                    target.Create();
                    try
                    {
                        this.Log().Info("Writing files to app directory: {0}", target.FullName);
                        await ReleasePackage.ExtractZipForInstall(
                            Path.Combine(updateInfo.PackageDirectory, release.Filename),
                            target.FullName,
                            rootAppDirectory,
                            progressCallback);
                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            //Don't leave that empty directory there: its existence will prevent the user from even using the previous version.
                            await Utility.DeleteDirectory(target.FullName);
                        }
                        catch (Exception error)
                        {
                            //This is going to be one very stuck user...
                            this.Log().ErrorException("Failed to cleanup new directory after failed install: " + target.FullName, error);
                        }
                        throw ex;
                    }

                    return target.FullName;
                }));
            }
Beispiel #2
0
            Task <string> installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release)
            {
                return(Task.Run(async() => {
                    var target = getDirectoryForRelease(release.Version);

                    // NB: This might happen if we got killed partially through applying the release
                    if (target.Exists)
                    {
                        this.Log().Warn("Found partially applied release folder, killing it: " + target.FullName);
                        await Utility.DeleteDirectory(target.FullName);
                    }

                    target.Create();

                    this.Log().Info("Writing files to app directory: {0}", target.FullName);
                    await ReleasePackage.ExtractZipForInstall(
                        Path.Combine(updateInfo.PackageDirectory, release.Filename),
                        target.FullName);

                    return target.FullName;
                }));
            }