feat: survey.FileFlusher 将会在目录不存在时自行创建
This commit is contained in:
parent
e4d60d7146
commit
d2f982bf42
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue