diff --git a/client/asink.go b/client/asink.go index 6684f38..050dff8 100644 --- a/client/asink.go +++ b/client/asink.go @@ -142,10 +142,10 @@ func ProcessLocalEvent(globals AsinkGlobals, event *asink.Event) { //get the file's hash hash, err := HashFile(tmpfilename) - event.Hash = hash if err != nil { panic(err) } + event.Hash = hash //If the file didn't actually change, squash this event if latestLocal != nil && event.Hash == latestLocal.Hash { @@ -231,16 +231,16 @@ func ProcessRemoteEvent(globals AsinkGlobals, event *asink.Event) { panic(err) } - //TODO copy hashed file to another tmp, then rename it to the actual file. + //copy hashed file to another tmp, then rename it to the actual file. tmpfilename, err = util.CopyToTmp(hashedFilename, globals.tmpDir) if err != nil { panic(err) } err = os.Rename(tmpfilename, absolutePath) if err != nil { - err := os.Remove(tmpfilename) - if err != nil { - panic(err) + err2 := os.Remove(tmpfilename) + if err2 != nil { + panic(err2) } panic(err) } diff --git a/client/watcher.go b/client/watcher.go index 1433b85..9bb6fe6 100644 --- a/client/watcher.go +++ b/client/watcher.go @@ -34,6 +34,7 @@ func StartWatching(watchDir string, fileUpdates chan *asink.Event) { if fi, err := os.Stat(ev.Name); err == nil && fi.IsDir() { if ev.IsCreate() { filepath.Walk(ev.Name, watchDirFn) + //TODO do a scan of this directory so we ensure any file events we missed before starting to watch this directory are caught } continue }