From 1fabcfbeb086e884b421f00bd52a16acbdaac1f5 Mon Sep 17 00:00:00 2001 From: caine tighe Date: Tue, 7 Jun 2011 16:25:44 -0400 Subject: [PATCH] osutil/paths.go : update for windows support --- lib/go/camli/osutil/paths.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/go/camli/osutil/paths.go b/lib/go/camli/osutil/paths.go index 9213d8562..a0e011dcc 100644 --- a/lib/go/camli/osutil/paths.go +++ b/lib/go/camli/osutil/paths.go @@ -19,10 +19,13 @@ package osutil import ( "os" "path/filepath" + "runtime" ) func HomeDir() string { - // TODO: windows support? is HOME correct? + if runtime.GOOS == "windows" { + return os.Getenv("HOMEPATH") + } return os.Getenv("HOME") } @@ -30,7 +33,9 @@ func CamliConfigDir() string { if p := os.Getenv("CAMLI_CONFIG_DIR"); 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") } @@ -38,4 +43,3 @@ func UserServerConfigPath() string { return filepath.Join(CamliConfigDir(), "serverconfig") } -