osutil: add per-OS CamliBlobRoot; use .camlistore, not .camli

Change-Id: I9e085d3f7a38357eca0bee0d5576a3db7cb1455e
This commit is contained in:
Brad Fitzpatrick 2012-03-19 13:07:46 -07:00
parent f877e849d6
commit c7d3f606b2
1 changed files with 12 additions and 2 deletions

View File

@ -37,14 +37,24 @@ func CacheDir() string {
return filepath.Join(HomeDir(), ".cache")
}
func CamliBlobRoot() string {
switch runtime.GOOS {
case "windows":
return filepath.Join(os.Getenv("APPDATA"), "Camlistore", "blobs")
case "darwin":
return filepath.Join(HomeDir(), "Library", "Camlistore", "blobs")
}
return filepath.Join(HomeDir(), "var", "camlistore", "blobs")
}
func CamliConfigDir() string {
if p := os.Getenv("CAMLI_CONFIG_DIR"); p != "" {
return p
}
if runtime.GOOS == "windows" {
return filepath.Join(os.Getenv("APPDATA"), "camli")
return filepath.Join(os.Getenv("APPDATA"), "Camlistore")
}
return filepath.Join(HomeDir(), ".camli")
return filepath.Join(HomeDir(), ".camlistore")
}
func UserServerConfigPath() string {