From c640859e727d8c919612be237183dd249b2371e7 Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Wed, 9 Oct 2024 15:16:37 -0500 Subject: [PATCH] Create file dir if it doesn't exist (#3) --- op-da/da/service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/op-da/da/service.go b/op-da/da/service.go index 8c1bdd2..f8ef845 100644 --- a/op-da/da/service.go +++ b/op-da/da/service.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/url" + "os" "strings" "sync/atomic" @@ -70,6 +71,10 @@ func newStore(cfg *CLIConfig) (altda.KVStore, error) { split := strings.SplitN(u.Path, "/", 2) return NewS3store(split[0], split[1]), nil case "file": + err = os.MkdirAll(u.Path, os.FileMode(0755)) + if err != nil { + return nil, fmt.Errorf("failed to create directory: %w", err) + } return NewFilestore(u.Path), nil default: return nil, fmt.Errorf("unsupported DA scheme: %s", u.Scheme)