mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-13 11:35:52 +01:00
Merge bff8d9dfd2
into c7191d2913
This commit is contained in:
commit
cd3dc8841c
1 changed files with 5 additions and 9 deletions
|
@ -29,18 +29,14 @@ func appDataDir(goos, appName string, roaming bool) string {
|
|||
appNameUpper := string(unicode.ToUpper(rune(appName[0]))) + appName[1:]
|
||||
appNameLower := string(unicode.ToLower(rune(appName[0]))) + appName[1:]
|
||||
|
||||
// Get the OS specific home directory via the Go standard lib.
|
||||
var homeDir string
|
||||
usr, err := user.Current()
|
||||
if err == nil {
|
||||
homeDir = usr.HomeDir
|
||||
}
|
||||
|
||||
// Fall back to standard HOME environment variable that works
|
||||
// for most POSIX OSes if the directory from the Go standard
|
||||
// lib failed.
|
||||
if err != nil || homeDir == "" {
|
||||
// If HOME is set, use it
|
||||
homeDir = os.Getenv("HOME")
|
||||
|
||||
// If not, Get the OS specific home directory via the Go standard lib.
|
||||
usr, err := user.Current()
|
||||
if err != nil || homeDir == "" {
|
||||
homeDir = usr.HomeDir
|
||||
}
|
||||
|
||||
switch goos {
|
||||
|
|
Loading…
Add table
Reference in a new issue