diff --git a/cmd/main.go b/cmd/main.go index 7e5bc0d..ab36f30 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -45,6 +45,12 @@ func main() { menuStorageService := storage.MenuStorageService{} + err := menuStorageService.EnsureDbDir(dbDir) + if err != nil { + fmt.Fprintf(os.Stderr, err.Error()) + os.Exit(1) + } + rs, err := menuStorageService.GetResource(scriptDir, ctx) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) diff --git a/internal/storage/storageservice.go b/internal/storage/storageservice.go index 4306153..b31b67d 100644 --- a/internal/storage/storageservice.go +++ b/internal/storage/storageservice.go @@ -31,10 +31,6 @@ type StorageService interface { type MenuStorageService struct{} func (menuStorageService *MenuStorageService) GetPersister(dbDir string, ctx context.Context) (*persist.Persister, error) { - err := ensureDbDir(dbDir) - if err != nil { - return nil, err - } store := gdbmdb.NewGdbmDb() storeFile := path.Join(dbDir, "state.gdbm") store.Connect(ctx, storeFile)