hrm/os_darwin.go

27 lines
486 B
Go
Raw Normal View History

2019-10-23 18:29:13 -04:00
package main
import (
"log"
"os"
"os/user"
"path"
)
var confDir string
func init() {
usr, err := user.Current()
if err != nil {
log.Fatal("Cannot get current user: ", err)
}
confDir = path.Join(usr.HomeDir, ".config/gohrm")
if _, err := os.Stat(confDir); os.IsNotExist(err) {
err = os.MkdirAll(confDir, 0700)
if err != nil {
log.Fatal("Cannot create configuration directory %s: %s", confDir, err)
} else {
log.Print("Configuration directory created")
}
}
}