Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgon Elbre <egonelbre@gmail.com>2013-12-15 18:49:23 +0400
committerspf13 <steve.francia@gmail.com>2013-12-28 22:46:09 +0400
commit1979f7d9c7d047340c9205f0d3e6d8393d498f9c (patch)
tree6e882cc1554da4f2ecb8651f9fccbc13ce212daf /source/filesystem.go
parente46148f948db3b8d86e9bae6228d5981fcb3b006 (diff)
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.
Diffstat (limited to 'source/filesystem.go')
-rw-r--r--source/filesystem.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/filesystem.go b/source/filesystem.go
index f44f003f0..cefe4a950 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
}
}