diff --git a/rootdir.go b/rootdir.go index 520f3e2..9ead788 100644 --- a/rootdir.go +++ b/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 path, nil + path = filepath.Join(homedir, publicRootDirName) + if "" == path { +/////////////////////// RETURN + return "", errors.New("empty path") } } - return "", nil + return path, nil }