From: Egon Elbre Date: Sun, 15 Dec 2013 14:49:23 +0000 (+0200) Subject: Avoid locking the files for an extended amount of time. Sublime Text X-Git-Tag: v0.10~79 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1979f7d9c7d047340c9205f0d3e6d8393d498f9c;p=brevno-suite%2Fhugo Avoid locking the files for an extended amount of time. Sublime Text doesn't like this and shows an error when modifying a file in rapid succession. --- diff --git a/source/filesystem.go b/source/filesystem.go index f44f003f..cefe4a95 100644 --- a/source/filesystem.go +++ b/source/filesystem.go @@ -1,8 +1,10 @@ package source import ( + "bytes" "errors" "io" + "io/ioutil" "os" "path" "path/filepath" @@ -93,11 +95,11 @@ func (f *Filesystem) captureFiles() { if ignoreDotFile(filePath) { return nil } - file, err := os.Open(filePath) + data, err := ioutil.ReadFile(filePath) if err != nil { return err } - f.add(filePath, file) + f.add(filePath, bytes.NewBuffer(data)) return nil } }