diff --git a/SparkleShare/Common/BaseController.cs b/SparkleShare/Common/BaseController.cs index 69834307..7382a2a5 100644 --- a/SparkleShare/Common/BaseController.cs +++ b/SparkleShare/Common/BaseController.cs @@ -343,9 +343,6 @@ namespace SparkleShare { void DetectRepositoryRenames () { foreach (string group_path in Directory.GetDirectories (Config.FoldersPath)) { - if (group_path.EndsWith (".tmp")) - continue; - foreach (string folder_path in Directory.GetDirectories (group_path)) { string folder_name = Path.GetFileName (folder_path); @@ -557,17 +554,16 @@ namespace SparkleShare { public void StartFetcher (SparkleFetcherInfo info) { - Directory.Delete (Config.TmpPath, true); - Directory.CreateDirectory (Config.TmpPath); - File.SetAttributes (Config.TmpPath, File.GetAttributes (Config.TmpPath) | FileAttributes.Hidden); - string canonical_name = Path.GetFileName (info.RemotePath); string backend = info.Backend; if (string.IsNullOrEmpty (backend)) backend = BaseFetcher.GetBackend (info.Address); - info.TargetDirectory = Path.Combine (Config.TmpPath, canonical_name); + info.TargetDirectory = Path.Combine (Config.TmpPath, canonical_name); + + if (Directory.Exists (info.TargetDirectory)) + Directory.Delete (info.TargetDirectory); try { this.fetcher = (BaseFetcher) Activator.CreateInstance ( @@ -678,7 +674,6 @@ namespace SparkleShare { } } - Directory.Delete (Config.TmpPath, true); string backend = BaseFetcher.GetBackend (this.fetcher.RemoteUrl.ToString ()); Config.AddFolder (target_folder_name, identifier, this.fetcher.RemoteUrl.ToString (), backend); diff --git a/Sparkles/Configuration.cs b/Sparkles/Configuration.cs index 395f84f5..eb0d7211 100644 --- a/Sparkles/Configuration.cs +++ b/Sparkles/Configuration.cs @@ -27,9 +27,10 @@ namespace Sparkles { public static Configuration DefaultConfiguration; public static bool DebugMode = true; - public readonly string DirectoryPath; + public readonly string DirectoryPath; public readonly string FilePath; public readonly string TmpPath; + public readonly string BinPath; public readonly string LogFilePath; @@ -58,12 +59,17 @@ namespace Sparkles { FilePath = Path.Combine (config_path, config_file_name); DirectoryPath = config_path; + BinPath = Path.Combine (config_path, "bin"); + + if (!Directory.Exists (BinPath)) + Directory.CreateDirectory (BinPath); + string logs_path = Path.Combine (config_path, "logs"); int i = 1; do { LogFilePath = Path.Combine ( - logs_path, "debug_log_" + DateTime.Now.ToString ("yyyy-MM-dd") + "." + i + ".txt"); + logs_path, "log_" + DateTime.Now.ToString ("yyyy-MM-dd") + "." + i + ".txt"); i++; @@ -73,7 +79,7 @@ namespace Sparkles { Directory.CreateDirectory (logs_path); // Delete logs older than a week - foreach (FileInfo file in new DirectoryInfo (logs_path).GetFiles ("debug_log*.txt")) { + foreach (FileInfo file in new DirectoryInfo (logs_path).GetFiles ("log*.txt")) { if (file.LastWriteTime < DateTime.Now.AddDays (-7)) file.Delete (); } @@ -103,7 +109,7 @@ namespace Sparkles { } finally { Load (FilePath); - TmpPath = Path.Combine (FoldersPath, ".tmp"); + TmpPath = Path.Combine (DirectoryPath, "tmp"); Directory.CreateDirectory (TmpPath); } }