HomeDir returns the path to the user's home directory. It returns the empty string if the value isn't known.
()
| 35 | // HomeDir returns the path to the user's home directory. |
| 36 | // It returns the empty string if the value isn't known. |
| 37 | func HomeDir() string { |
| 38 | failInTests() |
| 39 | if runtime.GOOS == "windows" { |
| 40 | return os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") |
| 41 | } |
| 42 | return os.Getenv("HOME") |
| 43 | } |
| 44 | |
| 45 | // Username returns the current user's username, as |
| 46 | // reported by the relevant environment variable. |
no test coverage detected