|
|
|
@ -598,8 +598,8 @@ func (i *Install) replaceRelease(rel *release.Release) error {
|
|
|
|
|
return i.recordRelease(last)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// write the <data> to <output-dir>/<name>. <append> controls if the file is created or content will be appended
|
|
|
|
|
func writeToFile(outputDir string, name string, data string, append bool) error {
|
|
|
|
|
// write the <data> to <output-dir>/<name>. <appendData> controls if the file is created or content will be appended
|
|
|
|
|
func writeToFile(outputDir string, name string, data string, appendData bool) error {
|
|
|
|
|
outfileName := strings.Join([]string{outputDir, name}, string(filepath.Separator))
|
|
|
|
|
|
|
|
|
|
err := ensureDirectoryForFile(outfileName)
|
|
|
|
@ -607,7 +607,7 @@ func writeToFile(outputDir string, name string, data string, append bool) error
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
f, err := createOrOpenFile(outfileName, append)
|
|
|
|
|
f, err := createOrOpenFile(outfileName, appendData)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -624,8 +624,8 @@ func writeToFile(outputDir string, name string, data string, append bool) error
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func createOrOpenFile(filename string, append bool) (*os.File, error) {
|
|
|
|
|
if append {
|
|
|
|
|
func createOrOpenFile(filename string, appendData bool) (*os.File, error) {
|
|
|
|
|
if appendData {
|
|
|
|
|
return os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0600)
|
|
|
|
|
}
|
|
|
|
|
return os.Create(filename)
|
|
|
|
|