From 1c7dca2d8eca739012c86c6f707851c95627a9a9 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 31 Oct 2013 16:07:17 +0800 Subject: [PATCH] add link support for windows --- cmd/build.go | 5 ----- cmd/helper.go | 13 +++++++++++++ cmd/helper_windows.go | 10 ++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 cmd/helper.go create mode 100644 cmd/helper_windows.go diff --git a/cmd/build.go b/cmd/build.go index 33463b7b3..e023f0864 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -121,11 +121,6 @@ func getChildPkgs(cpath string, ppkg *doc.Pkg, cachePkgs map[string]*doc.Pkg) er return nil } -func makeLink(oldPath, newPath string) error { - cmd := exec.Command("ln", "-s", oldPath, newPath) - return cmd.Run() -} - func runBuild(cmd *Command, args []string) { curPath, err := os.Getwd() if err != nil { diff --git a/cmd/helper.go b/cmd/helper.go new file mode 100644 index 000000000..aa80fc17d --- /dev/null +++ b/cmd/helper.go @@ -0,0 +1,13 @@ +// +// +build !windows + +package cmd + +import ( + "os/exec" +) + +func makeLink(oldPath, newPath string) error { + cmd := exec.Command("ln", "-s", oldPath, newPath) + return cmd.Run() +} diff --git a/cmd/helper_windows.go b/cmd/helper_windows.go new file mode 100644 index 000000000..ee3831442 --- /dev/null +++ b/cmd/helper_windows.go @@ -0,0 +1,10 @@ +package cmd + +import ( + "os/exec" +) + +func makeLink(oldPath, newPath string) error { + cmd := exec.Command("mklink", "/j", newPath, oldPath) + return cmd.Run() +}