func (t *Temporary) WriteFile(file string, contents io.Reader) error {
	fullPath := filepath.Join(t.Src, file)
	fileDir := filepath.Dir(fullPath)
	if err := os.MkdirAll(fileDir, 0700); err != nil {
		return fmt.Errorf("failed to create dir %s: %v", fileDir, err)
	}
	w, err := os.OpenFile(fullPath, os.O_CREATE|os.O_RDWR, 0600)
	if err != nil {
		return fmt.Errorf("couldn't open %s for writing: %v", fullPath, err)
	}
	defer loggedClose(fullPath, w)
	if _, err := io.Copy(w, contents); err != nil {
		return fmt.Errorf("copy failed: %v", err)
	}
	return nil
}
// WriteFile writes contents to file, where file is a path relative to the src directory.
// Any intermediate directories are created if needed.
WriteFile writes contents to file, where file is a path relative to the src directory.
Any intermediate directories are created if needed.
// WriteFile writes contents to file where file is a path relative to the src directory . // Any intermediate directories are created if needed .
func (t *Temporary) WriteFile(file string, contents io.Reader) error {
	fullPath := filepath.Join(t.Src, file)
	fileDir := filepath.Dir(fullPath)
	if err := os.MkdirAll(fileDir, 0700); err != nil {
		return fmt.Errorf("failed to create dir %s: %v", fileDir, err)
	}
	w, err := os.OpenFile(fullPath, os.O_CREATE|os.O_RDWR, 0600)
	if err != nil {
		return fmt.Errorf("couldn't open %s for writing: %v", fullPath, err)
	}
	defer loggedClose(fullPath, w)
	if _, err := io.Copy(w, contents); err != nil {
		return fmt.Errorf("copy failed: %v", err)
	}
	return nil
}
func ( t * Temporary ) WriteFile ( file string , contents io . Reader ) error { fullPath := filepath . Join ( t . Src , file ) fileDir := filepath . Dir ( fullPath ) if err := os . MkdirAll ( fileDir , 0700 ) ; err != nil { return fmt . Errorf ( " " , fileDir , err ) } w , err := os . OpenFile ( fullPath , os . O_CREATE | os . O_RDWR , 0600 ) if err != nil { return fmt . Errorf ( " " , fullPath , err ) } defer loggedClose ( fullPath , w ) if _ , err := io . Copy ( w , contents ) ; err != nil { return fmt . Errorf ( " " , err ) } return nil }
WriteFile writes contents to file, where file is a path relative to the src directory.
WriteFile writes contents to file where file is a path relative to the src directory .