mac watcher: stop some unnecessary triggers from taking place. fixes some double syncs.

This commit is contained in:
Hylke Bons 2013-01-26 22:47:36 +00:00
parent 3fccef5a6d
commit c671b5f4ae
2 changed files with 5 additions and 6 deletions

View file

@ -56,11 +56,10 @@ namespace SparkleShare {
base.Initialize (); base.Initialize ();
SparkleRepoBase.UseCustomWatcher = true; SparkleRepoBase.UseCustomWatcher = true;
this.watcher = new SparkleMacWatcher (Program.Controller.FoldersPath);
this.watcher.Changed += delegate (string path) { this.watcher.Changed += delegate (string path) {
FileSystemEventArgs fse_args = new FileSystemEventArgs (WatcherChangeTypes.Changed, FileSystemEventArgs fse_args = new FileSystemEventArgs (WatcherChangeTypes.Changed, path, "Unknown_File");
Path.Combine (SparkleConfig.DefaultConfig.FoldersPath, path), Path.GetFileName (path));
FileActivityTask [] tasks = new FileActivityTask [Repositories.Length]; FileActivityTask [] tasks = new FileActivityTask [Repositories.Length];
// FIXME: There are cases where the wrong repo is triggered, so // FIXME: There are cases where the wrong repo is triggered, so
@ -114,8 +113,6 @@ namespace SparkleShare {
public override bool CreateSparkleShareFolder () public override bool CreateSparkleShareFolder ()
{ {
this.watcher = new SparkleMacWatcher (Program.Controller.FoldersPath);
if (!Directory.Exists (Program.Controller.FoldersPath)) { if (!Directory.Exists (Program.Controller.FoldersPath)) {
Directory.CreateDirectory (Program.Controller.FoldersPath); Directory.CreateDirectory (Program.Controller.FoldersPath);

View file

@ -154,7 +154,9 @@ namespace SparkleShare {
string path = paths [0]; string path = paths [0];
path = path.Substring (Path.Length); path = path.Substring (Path.Length);
path = path.Trim ("/".ToCharArray ()); path = path.Trim ("/".ToCharArray ());
handler (path);
if (!string.IsNullOrWhiteSpace (path))
handler (path);
} }
GC.KeepAlive (this); GC.KeepAlive (this);