mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-26 19:43:48 +00:00
28908aa3cf
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
18 lines
373 B
Go
18 lines
373 B
Go
package io
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// MakeDirForFile creates a directory provided in the filePath.
|
|
func MakeDirForFile(filePath string, creator string) error {
|
|
fileName := filePath
|
|
dir := filepath.Dir(fileName)
|
|
err := os.MkdirAll(dir, os.ModePerm)
|
|
if err != nil {
|
|
return fmt.Errorf("could not create dir for %s: %w", creator, err)
|
|
}
|
|
return nil
|
|
}
|