From fc51ec31ce9640bae3b4c89fc92be240d573a7c5 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 24 Dec 2011 19:43:29 +0100 Subject: [PATCH] mac watcher: also check the timestamps of files --- SparkleShare/Mac/SparkleMacWatcher.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/SparkleShare/Mac/SparkleMacWatcher.cs b/SparkleShare/Mac/SparkleMacWatcher.cs index 1acf2627..cb09d80b 100755 --- a/SparkleShare/Mac/SparkleMacWatcher.cs +++ b/SparkleShare/Mac/SparkleMacWatcher.cs @@ -28,7 +28,7 @@ namespace SparkleShare { public delegate void ChangedEventHandler (string path); public event ChangedEventHandler Changed; - private DirectoryInfo last_changed; + private FileSystemInfo last_changed; private Thread thread; @@ -50,7 +50,7 @@ namespace SparkleShare { Changed (relative_path); } - Thread.Sleep (2500); + Thread.Sleep (10 * 1000); } })); @@ -73,7 +73,16 @@ namespace SparkleShare { } } - } catch (Exception) { } + foreach (FileInfo info in parent.GetFiles ()) { + if (!info.FullName.Contains ("/.")) { + if (DateTime.Compare (info.LastWriteTime, this.last_changed.LastWriteTime) > 0) + this.last_changed = (FileSystemInfo) info; + } + } + + } catch (Exception) { + // Don't care... + } }