1
0
mirror of https://github.com/golang/go synced 2024-11-20 06:44:40 -07:00

godoc: fix writeFileAtomically utility function

If the filename was absolute, writeFileAtomically
used the wrong filename for ioutil.TempFile leading
to non-existent directories and the TempFile would
fail.

R=r, r2
CC=golang-dev
https://golang.org/cl/4224043
This commit is contained in:
Robert Griesemer 2011-02-24 11:13:20 -08:00
parent 11bda7df47
commit c9021a1afe

View File

@ -95,7 +95,7 @@ func canonicalizePaths(list []string, filter func(path string) bool) []string {
// atomically renames that file to the file named by filename.
//
func writeFileAtomically(filename string, data []byte) os.Error {
f, err := ioutil.TempFile(cwd, filename)
f, err := ioutil.TempFile(pathutil.Split(filename))
if err != nil {
return err
}