Implement OS sensitive dataDirs

This commit is contained in:
Maran
2015-02-23 11:28:20 +01:00
parent dd086791ac
commit 40adb7feb6
6 changed files with 25 additions and 27 deletions

View File

@ -3,10 +3,22 @@ package ethutil
import (
"fmt"
"math/big"
"os/user"
"path"
"runtime"
"time"
)
func DefaultDataDir() string {
usr, _ := user.Current()
if runtime.GOOS == "darwin" {
return path.Join(usr.HomeDir, "Library/Ethereum")
} else if runtime.GOOS == "windows" {
return path.Join(usr.HomeDir, "AppData/Roaming/Ethereum")
} else {
return path.Join(usr.HomeDir, ".ethereum")
}
}
func IsWindows() bool {
return runtime.GOOS == "windows"
}