Hide temporary files on Windows (fixes #146)

This commit is contained in:
Jakob Borg
2014-04-22 14:26:51 +02:00
parent 90d0896848
commit 35ebdc76ff
4 changed files with 75 additions and 10 deletions

View File

@@ -313,6 +313,7 @@ func (p *puller) handleRequestResult(res requestResult) {
t := time.Unix(f.Modified, 0)
os.Chtimes(of.temp, t, t)
os.Chmod(of.temp, os.FileMode(f.Flags&0777))
defTempNamer.Show(of.temp)
if debugPull {
dlog.Printf("pull: rename %q / %q: %q", p.repo, f.Name, of.filepath)
}
@@ -371,6 +372,7 @@ func (p *puller) handleBlock(b bqBlock) {
p.requestSlots <- true
return
}
defTempNamer.Hide(of.temp)
}
if of.err != nil {
@@ -514,6 +516,7 @@ func (p *puller) handleEmptyBlock(b bqBlock) {
t := time.Unix(f.Modified, 0)
os.Chtimes(of.temp, t, t)
os.Chmod(of.temp, os.FileMode(f.Flags&0777))
defTempNamer.Show(of.temp)
Rename(of.temp, of.filepath)
}
delete(p.openFiles, f.Name)