osutil/paths.go : update for windows support

This commit is contained in:
caine tighe 2011-06-07 16:25:44 -04:00
parent 0f99774750
commit 1fabcfbeb0
1 changed files with 7 additions and 3 deletions

View File

@ -19,10 +19,13 @@ package osutil
import ( import (
"os" "os"
"path/filepath" "path/filepath"
"runtime"
) )
func HomeDir() string { func HomeDir() string {
// TODO: windows support? is HOME correct? if runtime.GOOS == "windows" {
return os.Getenv("HOMEPATH")
}
return os.Getenv("HOME") return os.Getenv("HOME")
} }
@ -30,7 +33,9 @@ func CamliConfigDir() string {
if p := os.Getenv("CAMLI_CONFIG_DIR"); p != "" { if p := os.Getenv("CAMLI_CONFIG_DIR"); p != "" {
return p return p
} }
// TODO: windows / mac support in their proper places if runtime.GOOS == "windows" {
return filepath.Join(os.Getenv("APPDATA"), "camli")
}
return filepath.Join(HomeDir(), ".camli") return filepath.Join(HomeDir(), ".camli")
} }
@ -38,4 +43,3 @@ func UserServerConfigPath() string {
return filepath.Join(CamliConfigDir(), "serverconfig") return filepath.Join(CamliConfigDir(), "serverconfig")
} }