mirror of
https://github.com/cubixle/tuugen.git
synced 2026-04-24 18:34:44 +01:00
20 lines
275 B
Go
20 lines
275 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func createFile(path string) (*os.File, error) {
|
|
fp := filepath.Dir(path)
|
|
if err := os.MkdirAll(fp, 0777); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
f, err := os.Create(path)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return f, nil
|
|
}
|