github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/io/fileWriter.go (about) 1 package io 2 3 import ( 4 "fmt" 5 "os" 6 "path/filepath" 7 ) 8 9 // MakeDirForFile creates a directory provided in the filePath. 10 func MakeDirForFile(filePath string, creator string) error { 11 fileName := filePath 12 dir := filepath.Dir(fileName) 13 err := os.MkdirAll(dir, os.ModePerm) 14 if err != nil { 15 return fmt.Errorf("could not create dir for %s: %w", creator, err) 16 } 17 return nil 18 }