feat: survey.FileFlusher 将会在目录不存在时自行创建

This commit is contained in:
kercylan98 2023-10-27 15:53:45 +08:00
parent e4d60d7146
commit d2f982bf42
1 changed files with 1 additions and 0 deletions

View File

@ -17,6 +17,7 @@ func NewFileFlusher(filePath string, layout ...string) *FileFlusher {
ext := filepath.Ext(fn)
fn = strings.TrimSuffix(fn, ext)
dir := filepath.Dir(filePath)
_ = os.MkdirAll(dir, 0666)
fl := &FileFlusher{
dir: dir,
fn: fn,