initial commits
parent
64fa15d571
commit
94eed81927
21
rootdir.go
21
rootdir.go
|
@ -32,27 +32,28 @@ const (
|
|||
// fmt.Printf("The maymoon root-dir is at %q \n", rootDir)
|
||||
func RootDir() (string, error) {
|
||||
|
||||
var path string
|
||||
|
||||
{
|
||||
path = os.Getenv(publicRootEnvName)
|
||||
path := os.Getenv(publicRootEnvName)
|
||||
if "" != path {
|
||||
/////////////////////// RETURN
|
||||
return path, nil
|
||||
}
|
||||
}
|
||||
|
||||
var path string
|
||||
{
|
||||
homedir, err := os.UserHomeDir()
|
||||
if nil != err {
|
||||
return "", fmt.Errorf("problem getting user home-directory: %s", err)
|
||||
/////////////////////// RETURN
|
||||
return "", fmt.Errorf("problem getting user home-directory: %w", err)
|
||||
}
|
||||
|
||||
path = filepath.Join(homedir, publicRootDirName)
|
||||
if "" == path {
|
||||
/////////////////////// RETURN
|
||||
return "", errors.New("empty path")
|
||||
}
|
||||
}
|
||||
|
||||
path := filepath.Join(homedir, publicRootDirName)
|
||||
if "" != path {
|
||||
return path, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue