mirror of https://github.com/docker/docs.git
use cross-compile compatible home dir detection
Signed-off-by: Matt Drollette <matt@drollette.com>
This commit is contained in:
parent
29bbf0fb27
commit
a66abedab5
16
flags.go
16
flags.go
|
@ -1,21 +1,17 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"os/user"
|
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
"os"
|
||||||
log "github.com/Sirupsen/logrus"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func homepath(p string) string {
|
func homepath(p string) string {
|
||||||
usr, err := user.Current()
|
if runtime.GOOS == "windows" {
|
||||||
if err != nil {
|
return filepath.Join(os.Getenv("USERPROFILE"), p)
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
return path.Join(usr.HomeDir, p)
|
return filepath.Join(os.Getenv("HOME"), p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDiscovery(c *cli.Context) string {
|
func getDiscovery(c *cli.Context) string {
|
||||||
|
|
Loading…
Reference in New Issue