mirror of https://github.com/perkeep/perkeep.git
osutil/paths.go : update for windows support
This commit is contained in:
parent
0f99774750
commit
1fabcfbeb0
|
@ -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")
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue