feat: change storage setting

This commit is contained in:
Simon Ding
2024-07-14 18:16:17 +08:00
parent 1edbd8fe6e
commit 6a5ff9707e
30 changed files with 995 additions and 857 deletions

View File

@@ -14,8 +14,12 @@ type Storage interface {
ReadDir(dir string) ([]fs.FileInfo, error)
}
func NewLocalStorage(dir string) *LocalStorage {
return &LocalStorage{dir: dir}
func NewLocalStorage(dir string) (*LocalStorage, error) {
if _, err := os.Stat(dir); err != nil {
return nil, errors.Wrap(err, "stat")
}
return &LocalStorage{dir: dir}, nil
}
type LocalStorage struct {