make.go: fix zip corruption with extra bytes from newlines

Change-Id: Ib6fc01c60885898e09abaea4e8eec0e79fb7581a
This commit is contained in:
Brad Fitzpatrick 2013-06-18 18:39:43 -07:00
parent 3a8dc35241
commit 757c09cb87
1 changed files with 8 additions and 1 deletions

View File

@ -344,7 +344,13 @@ func embedClosure(closureDir, embedFile string) error {
// first, zip it
var zipbuf bytes.Buffer
w := zip.NewWriter(&zipbuf)
var zipdest io.Writer = &zipbuf
if os.Getenv("CAMLI_WRITE_TMP_ZIP") != "" {
f, _ := os.Create("/tmp/camli-closure.zip")
zipdest = io.MultiWriter(zipdest, f)
defer f.Close()
}
w := zip.NewWriter(zipdest)
err := filepath.Walk(closureDir, func(path string, fi os.FileInfo, err error) error {
if err != nil {
return err
@ -415,6 +421,7 @@ func quote(dest *bytes.Buffer, bs []byte) {
for _, b := range bs {
if b == '\n' {
dest.WriteString(`\n`)
continue
}
if b == '\\' {
dest.WriteString(`\\`)