projector/filer.go
2021-03-10 19:17:13 +00:00

29 lines
541 B
Go

package main
import (
"os"
"path/filepath"
)
func createDir(fpath string) error {
if err := os.Mkdir(filepath.Dir(fpath + string(filepath.Separator)), 0770); err != nil {
return err
}
return nil
}
// for generating the project blanks
func createFile(fpath string) error {
// create directory automatically, if non-existent
if err := os.MkdirAll(filepath.Dir(fpath), 0770); err != nil {
return err
}
//create the file, but that's all
file, err := os.Create(fpath)
if err != nil {
return err
}
file.Close()
return nil
}