From c671b5f4ae9f571b0fb2237ca922b700f642363b Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 26 Jan 2013 22:47:36 +0000 Subject: [PATCH] mac watcher: stop some unnecessary triggers from taking place. fixes some double syncs. --- SparkleShare/Mac/SparkleController.cs | 7 ++----- SparkleShare/Mac/SparkleMacWatcher.cs | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/SparkleShare/Mac/SparkleController.cs b/SparkleShare/Mac/SparkleController.cs index e342dc04..3a38e6da 100755 --- a/SparkleShare/Mac/SparkleController.cs +++ b/SparkleShare/Mac/SparkleController.cs @@ -56,11 +56,10 @@ namespace SparkleShare { base.Initialize (); SparkleRepoBase.UseCustomWatcher = true; + this.watcher = new SparkleMacWatcher (Program.Controller.FoldersPath); this.watcher.Changed += delegate (string path) { - FileSystemEventArgs fse_args = new FileSystemEventArgs (WatcherChangeTypes.Changed, - Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, path), Path.GetFileName (path)); - + FileSystemEventArgs fse_args = new FileSystemEventArgs (WatcherChangeTypes.Changed, path, "Unknown_File"); FileActivityTask [] tasks = new FileActivityTask [Repositories.Length]; // FIXME: There are cases where the wrong repo is triggered, so @@ -114,8 +113,6 @@ namespace SparkleShare { public override bool CreateSparkleShareFolder () { - this.watcher = new SparkleMacWatcher (Program.Controller.FoldersPath); - if (!Directory.Exists (Program.Controller.FoldersPath)) { Directory.CreateDirectory (Program.Controller.FoldersPath); diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/SparkleMacWatcher.cs index 6642918f..07b0b08b 100755 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/SparkleMacWatcher.cs @@ -154,7 +154,9 @@ namespace SparkleShare { string path = paths [0]; path = path.Substring (Path.Length); path = path.Trim ("/".ToCharArray ()); - handler (path); + + if (!string.IsNullOrWhiteSpace (path)) + handler (path); } GC.KeepAlive (this);