1
0
Fork 0

Miscellaneous fixups

This commit is contained in:
Aaron Lindsay 2013-08-14 22:58:34 -04:00
parent f80639c815
commit ccb35fc7a6
2 changed files with 6 additions and 5 deletions

View File

@ -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)
}

View File

@ -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
}