projector/filer.go

29 lines
541 B
Go
Raw Normal View History

2021-03-09 18:52:34 +00:00
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
2021-03-09 18:52:34 +00:00
}
return nil
2021-03-09 18:52:34 +00:00
}
// for generating the project blanks
func createFile(fpath string) error {
// create directory automatically, if non-existent
2021-03-09 18:52:34 +00:00
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
2021-03-09 18:52:34 +00:00
}
file.Close()
return nil
2021-03-09 18:52:34 +00:00
}