diff options
| author | Petter Rasmussen | 2016-01-11 21:36:33 +0100 | 
|---|---|---|
| committer | Petter Rasmussen | 2016-01-16 22:09:45 +0100 | 
| commit | 137298be0c1ec3e95825971fa25f0877ec884ad4 (patch) | |
| tree | 05a9c5950df2adddae5818bfad7699bd9bc07ebe /util.go | |
| parent | 3c7e4127ab7722146ab688dbe0c39e73d8a08b8b (diff) | |
| download | gdrive-137298be0c1ec3e95825971fa25f0877ec884ad4.tar.bz2 | |
Basic list and download support
Diffstat (limited to 'util.go')
| -rw-r--r-- | util.go | 29 | 
1 files changed, 29 insertions, 0 deletions
| @@ -0,0 +1,29 @@ +package main + +import ( +    "runtime" +    "path/filepath" +    "fmt" +    "os" +) + +func GetDefaultConfigDir() string { +    return filepath.Join(Homedir(), ".gdrive") +} + +func GetDefaultTokenFilePath() string { +    return filepath.Join(GetDefaultConfigDir(), "token.json") +} + +func Homedir() string { +	if runtime.GOOS == "windows" { +		return os.Getenv("APPDATA") +	} +	return os.Getenv("HOME") +} + +func ExitF(format string, a ...interface{}) { +	fmt.Fprintf(os.Stderr, format, a...) +	fmt.Println("") +	os.Exit(1) +} | 
