Implement OS sensitive dataDirs

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

No files matched your search

+12
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"
}