Use USERPROFILE path on Windows as home directory

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
This commit is contained in:
Ahmet Alp Balkan 2014-10-21 16:15:26 -07:00
parent e45b0f9271
commit d4dbb70832
1 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"github.com/docker/docker/opts"
flag "github.com/docker/docker/pkg/mflag"
@ -16,10 +17,17 @@ var (
func init() {
if dockerCertPath == "" {
dockerCertPath = filepath.Join(os.Getenv("HOME"), ".docker")
dockerCertPath = filepath.Join(getHomeDir(), ".docker")
}
}
func getHomeDir() string {
if runtime.GOOS == "windows" {
return os.Getenv("USERPROFILE")
}
return os.Getenv("HOME")
}
var (
flVersion = flag.Bool([]string{"v", "-version"}, false, "Print version information and quit")
flDaemon = flag.Bool([]string{"d", "-daemon"}, false, "Enable daemon mode")