initial commits

master
Charles Iliya Krempeaux 2023-08-14 21:45:46 -07:00
parent 64fa15d571
commit 94eed81927
1 changed files with 9 additions and 8 deletions

View File

@ -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 path, nil
path = filepath.Join(homedir, publicRootDirName)
if "" == path {
/////////////////////// RETURN
return "", errors.New("empty path")
}
}
return "", nil
return path, nil
}