From b33b321207d3a322af67c269dbeffc34a9f32816 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 28 May 2011 17:52:14 +0100 Subject: [PATCH] controller: create and delete .tmp folder before and after fetching respectively --- SparkleShare/SparkleController.cs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 0f3b22ee..3ced2aaa 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -92,11 +92,6 @@ namespace SparkleShare { { SparklePath = SparklePaths.SparklePath; - // Remove temporary file - SparkleHelpers.ClearAttributes (SparklePaths.SparkleTmpPath); - if (Directory.Exists (SparklePaths.SparkleTmpPath)) - Directory.Delete (SparklePaths.SparkleTmpPath, true); - InstallLauncher (); EnableSystemAutostart (); @@ -911,6 +906,9 @@ namespace SparkleShare { public void FetchFolder (string url, string name) { + if (!Directory.Exists (SparklePaths.SparkleTmpPath)) + Directory.CreateDirectory (SparklePaths.SparkleTmpPath); + SparkleHelpers.DebugInfo ("Controller", "Formed URL: " + url); string host = GetHost (url); @@ -974,7 +972,6 @@ namespace SparkleShare { SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); } - SparkleConfig.DefaultConfig.AddFolder (target_folder_name, url, backend); AddRepository (target_folder_path); @@ -990,24 +987,22 @@ namespace SparkleShare { FolderListChanged (); fetcher.Dispose (); + + if (Directory.Exists (SparklePaths.SparkleTmpPath)) + Directory.Delete (SparklePaths.SparkleTmpPath, true); }; fetcher.Failed += delegate { EnableHostKeyCheckingForHost (host); - if (Directory.Exists (tmp_folder)) { - SparkleHelpers.ClearAttributes (tmp_folder); - Directory.Delete (tmp_folder, true); - - SparkleHelpers.DebugInfo ("Config", - "Deleted temporary directory: " + tmp_folder); - } - if (FolderFetchError != null) FolderFetchError (); fetcher.Dispose (); + + if (Directory.Exists (SparklePaths.SparkleTmpPath)) + Directory.Delete (SparklePaths.SparkleTmpPath, true); };