mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Plumb some methods to give us paths we can use
This commit is contained in:
@@ -43,7 +43,9 @@ namespace Squirrel
|
||||
/// CheckForUpdate</param>
|
||||
/// <param name="progress">A Observer which can be used to report Progress -
|
||||
/// will return values from 0-100 and Complete, or Throw</param>
|
||||
Task ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null);
|
||||
/// <returns>The path to the installed application (i.e. the path where
|
||||
/// your package's contents ended up</returns>
|
||||
Task<string> ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null);
|
||||
|
||||
/// <summary>
|
||||
/// Completely Installs a targeted app
|
||||
|
||||
@@ -26,14 +26,14 @@ namespace Squirrel
|
||||
this.rootAppDirectory = rootAppDirectory;
|
||||
}
|
||||
|
||||
public async Task ApplyReleases(UpdateInfo updateInfo, bool silentInstall, Action<int> progress = null)
|
||||
public async Task<string> ApplyReleases(UpdateInfo updateInfo, bool silentInstall, Action<int> progress = null)
|
||||
{
|
||||
progress = progress ?? (_ => { });
|
||||
|
||||
var release = await createFullPackagesFromDeltas(updateInfo.ReleasesToApply, updateInfo.CurrentlyInstalledVersion);
|
||||
progress(10);
|
||||
|
||||
await installPackageToAppDir(updateInfo, release);
|
||||
var ret = await installPackageToAppDir(updateInfo, release);
|
||||
progress(30);
|
||||
|
||||
var currentReleases = await updateLocalReleasesFile();
|
||||
@@ -45,6 +45,8 @@ namespace Squirrel
|
||||
|
||||
await cleanDeadVersions(newVersion);
|
||||
progress(100);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public async Task FullUninstall()
|
||||
@@ -61,7 +63,7 @@ namespace Squirrel
|
||||
await Utility.DeleteDirectoryWithFallbackToNextReboot(rootAppDirectory);
|
||||
}
|
||||
|
||||
async Task installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release)
|
||||
async Task<string> installPackageToAppDir(UpdateInfo updateInfo, ReleaseEntry release)
|
||||
{
|
||||
var pkg = new ZipPackage(Path.Combine(updateInfo.PackageDirectory, release.Filename));
|
||||
var target = getDirectoryForRelease(release.Version);
|
||||
@@ -98,6 +100,7 @@ namespace Squirrel
|
||||
// which shortcuts to install, and nuking them. Then, run the app's
|
||||
// post install and set up shortcuts.
|
||||
runPostInstallAndCleanup(newCurrentVersion, updateInfo.IsBootstrapping);
|
||||
return target.FullName;
|
||||
}
|
||||
|
||||
void CopyFileToLocation(FileSystemInfo target, IPackageFile x)
|
||||
|
||||
@@ -60,12 +60,12 @@ namespace Squirrel
|
||||
await downloadReleases.DownloadReleases(updateUrlOrPath, releasesToDownload, progress, urlDownloader);
|
||||
}
|
||||
|
||||
public async Task ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null)
|
||||
public async Task<string> ApplyReleases(UpdateInfo updateInfo, Action<int> progress = null)
|
||||
{
|
||||
var applyReleases = new ApplyReleasesImpl(rootAppDirectory);
|
||||
await acquireUpdateLock();
|
||||
|
||||
await applyReleases.ApplyReleases(updateInfo, false, progress);
|
||||
return await applyReleases.ApplyReleases(updateInfo, false, progress);
|
||||
}
|
||||
|
||||
public async Task FullInstall(bool silentInstall = false)
|
||||
@@ -152,6 +152,10 @@ namespace Squirrel
|
||||
key.DeleteSubKeyTree(applicationName);
|
||||
}
|
||||
|
||||
public string RootAppDirectory {
|
||||
get { return rootAppDirectory; }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
var disp = Interlocked.Exchange(ref updateLock, null);
|
||||
|
||||
Reference in New Issue
Block a user