Files
kind/pkg/cluster/internal/providers/common/logs.go
2025-08-04 19:02:45 -07:00

17 lines
364 B
Go

package common
import (
"os"
"path/filepath"
)
// FileOnHost is a helper to create a file at path
// even if the parent directory doesn't exist
// in which case it will be created with ModePerm
func FileOnHost(path string) (*os.File, error) {
if err := os.MkdirAll(filepath.Dir(path), os.ModePerm); err != nil {
return nil, err
}
return os.Create(path)
}