diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-03-01 15:42:44 -0500 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-03-01 15:42:44 -0500 |
| commit | e3b42ad59e458cf4df0de5c6055bf484edcda900 (patch) | |
| tree | 74f3bf8d75ed387cadfe408f0dd659148b81fd87 /MediaBrowser.Common.Implementations/Updates/PackageManager.cs | |
| parent | 833639ff87569140027e4402391f18bbabbec6b2 (diff) | |
Remove archive extraction from PackageManager
It is no longer needed as the installer does this
Diffstat (limited to 'MediaBrowser.Common.Implementations/Updates/PackageManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/Updates/PackageManager.cs | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/MediaBrowser.Common.Implementations/Updates/PackageManager.cs b/MediaBrowser.Common.Implementations/Updates/PackageManager.cs index f53f503db..cef631e60 100644 --- a/MediaBrowser.Common.Implementations/Updates/PackageManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/PackageManager.cs @@ -43,12 +43,12 @@ namespace MediaBrowser.Common.Implementations.Updates } - public async Task InstallPackage(IHttpClient client, ILogger logger, ResourcePool resourcePool, IProgress<double> progress, IZipClient zipClient, IApplicationPaths appPaths, PackageVersionInfo package, CancellationToken cancellationToken) + public async Task InstallPackage(IHttpClient client, ILogger logger, ResourcePool resourcePool, IProgress<double> progress, IApplicationPaths appPaths, PackageVersionInfo package, CancellationToken cancellationToken) { // Target based on if it is an archive or single assembly // zip archives are assumed to contain directory structures relative to our ProgramDataPath var isArchive = string.Equals(Path.GetExtension(package.targetFilename), ".zip", StringComparison.OrdinalIgnoreCase); - var target = isArchive ? appPaths.TempUpdatePath : Path.Combine(appPaths.PluginsPath, package.targetFilename); + var target = Path.Combine(isArchive ? appPaths.TempUpdatePath : appPaths.PluginsPath, package.targetFilename); // Download to temporary file so that, if interrupted, it won't destroy the existing installation var tempFile = await client.GetTempFile(package.sourceUrl, resourcePool.Mb, cancellationToken, progress).ConfigureAwait(false); @@ -71,32 +71,16 @@ namespace MediaBrowser.Common.Implementations.Updates cancellationToken.ThrowIfCancellationRequested(); - // Success - move it to the real target based on type - if (isArchive) + // Success - move it to the real target + try { - try - { - zipClient.ExtractAll(tempFile, target, true); - } - catch (IOException e) - { - logger.ErrorException("Error attempting to extract archive from {0} to {1}", e, tempFile, target); - throw; - } - + File.Copy(tempFile, target, true); + File.Delete(tempFile); } - else + catch (IOException e) { - try - { - File.Copy(tempFile, target, true); - File.Delete(tempFile); - } - catch (IOException e) - { - logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target); - throw; - } + logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target); + throw; } } |
