|
|
@ -82,7 +82,7 @@ func (d Dir) Mkdir(ctx context.Context, name string, perm os.FileMode) error {
|
|
|
|
if name = d.resolve(name); name == "" {
|
|
|
|
if name = d.resolve(name); name == "" {
|
|
|
|
return os.ErrNotExist
|
|
|
|
return os.ErrNotExist
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return os.Mkdir(name, perm)
|
|
|
|
return os.MkdirAll(name, perm)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (d Dir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error) {
|
|
|
|
func (d Dir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (File, error) {
|
|
|
@ -91,6 +91,13 @@ func (d Dir) OpenFile(ctx context.Context, name string, flag int, perm os.FileMo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f, err := os.OpenFile(name, flag, perm)
|
|
|
|
f, err := os.OpenFile(name, flag, perm)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
|
|
|
|
err = os.MkdirAll(filepath.Dir(name), 0777)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return d.OpenFile(ctx, name, flag, perm)
|
|
|
|
|
|
|
|
}
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return f, nil
|
|
|
|
return f, nil
|
|
|
|