Fix homedir for Windows.

Signed-off-by: Jeff Mendoza <jeffmendoza@live.com>
This commit is contained in:
Jeff Mendoza 2014-12-09 15:51:15 -08:00
parent c4366fb0a5
commit 50e5b2501a
1 changed files with 7 additions and 1 deletions

View File

@ -4,10 +4,16 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
homedir "github.com/mitchellh/go-homedir"
) )
func PublicKeyPath() string { func PublicKeyPath() string {
return filepath.Join(os.Getenv("HOME"), ".docker/public-key.json") homeDir, err := homedir.Dir()
if err != nil {
homeDir = ""
}
return filepath.Join(homeDir, ".docker/public-key.json")
} }
func AddPublicKeyToAuthorizedHosts(d Driver, authorizedKeysPath string) error { func AddPublicKeyToAuthorizedHosts(d Driver, authorizedKeysPath string) error {