Use USERPROFILE path on Windows as home directory

Signed-off-by: Ahmet Alp Balkan <ahmetb@microsoft.com>
Upstream-commit: d4dbb708320e59efa91b077303c87f9e9513cd91
Component: engine
This commit is contained in:
Ahmet Alp Balkan
2014-10-21 16:15:26 -07:00
parent deefafa9d6
commit a64d9e402a

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")