mirror of
https://github.com/btcsuite/btcd.git
synced 2025-03-13 19:37:39 +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:]
|
appNameUpper := string(unicode.ToUpper(rune(appName[0]))) + appName[1:]
|
||||||
appNameLower := string(unicode.ToLower(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
|
var homeDir string
|
||||||
usr, err := user.Current()
|
// If HOME is set, use it
|
||||||
if err == nil {
|
homeDir = os.Getenv("HOME")
|
||||||
homeDir = usr.HomeDir
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fall back to standard HOME environment variable that works
|
// If not, Get the OS specific home directory via the Go standard lib.
|
||||||
// for most POSIX OSes if the directory from the Go standard
|
usr, err := user.Current()
|
||||||
// lib failed.
|
|
||||||
if err != nil || homeDir == "" {
|
if err != nil || homeDir == "" {
|
||||||
homeDir = os.Getenv("HOME")
|
homeDir = usr.HomeDir
|
||||||
}
|
}
|
||||||
|
|
||||||
switch goos {
|
switch goos {
|
||||||
|
|
Loading…
Add table
Reference in a new issue