From e3b42ad59e458cf4df0de5c6055bf484edcda900 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Fri, 1 Mar 2013 15:42:44 -0500 Subject: Remove archive extraction from PackageManager It is no longer needed as the installer does this --- .../Updates/PackageManager.cs | 34 ++++++---------------- 1 file changed, 9 insertions(+), 25 deletions(-) (limited to 'MediaBrowser.Common.Implementations/Updates') 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 progress, IZipClient zipClient, IApplicationPaths appPaths, PackageVersionInfo package, CancellationToken cancellationToken) + public async Task InstallPackage(IHttpClient client, ILogger logger, ResourcePool resourcePool, IProgress 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; } } -- cgit v1.2.3