aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Reed <ebr@mediabrowser3.com>2013-04-14 10:44:34 -0400
committerEric Reed <ebr@mediabrowser3.com>2013-04-14 10:44:34 -0400
commit9553c8b14ce9345a8ef8c397301bfc74fdb50251 (patch)
treec7b6e192e31f631a35ecbae81d41fd7caee8711e
parent587d3c1908287c8f6c893355c18a4d5d15541952 (diff)
Delete archive even on failure so we won't re-try the same update
-rw-r--r--MediaBrowser.Installer/MainWindow.xaml.cs32
1 files changed, 20 insertions, 12 deletions
diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs
index ee87e9bf2..a3becf631 100644
--- a/MediaBrowser.Installer/MainWindow.xaml.cs
+++ b/MediaBrowser.Installer/MainWindow.xaml.cs
@@ -269,22 +269,13 @@ namespace MediaBrowser.Installer
{
ExtractPackage(archive);
// We're done with it so delete it (this is necessary for update operations)
- try
- {
- File.Delete(archive);
- }
- catch (FileNotFoundException)
- {
- }
- catch (Exception e)
- {
- SystemClose("Error Removing Archive - " + e.GetType().FullName + "\n\n" + e.Message);
- return;
- }
+ TryDelete(archive);
}
catch (Exception e)
{
SystemClose("Error Extracting - " + e.GetType().FullName + "\n\n" + e.Message);
+ // Delete archive even if failed so we don't try again with this one
+ TryDelete(archive);
return;
}
@@ -337,6 +328,23 @@ namespace MediaBrowser.Installer
}
+ private bool TryDelete(string file)
+ {
+ try
+ {
+ File.Delete(file);
+ }
+ catch (FileNotFoundException)
+ {
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
private void PismoInstall()
{
// Kick off the Pismo installer and wait for it to end