From 1f2154738be526da9aa9868cbfab9b91eeb49e87 Mon Sep 17 00:00:00 2001 From: bonfy Date: Thu, 12 Apr 2018 16:05:36 +0800 Subject: [PATCH] add os.PathSeparator to the return value of findCmdDir func --- cobra/cmd/project.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cobra/cmd/project.go b/cobra/cmd/project.go index 7ddb8258..c7503b37 100644 --- a/cobra/cmd/project.go +++ b/cobra/cmd/project.go @@ -134,21 +134,21 @@ func (p *Project) CmdPath() string { // looks for existing cmd dir in absPath. func findCmdDir(absPath string) string { if !exists(absPath) || isEmpty(absPath) { - return "cmd" + return string(os.PathSeparator) + "cmd" } if isCmdDir(absPath) { - return filepath.Base(absPath) + return string(os.PathSeparator) + filepath.Base(absPath) } files, _ := filepath.Glob(filepath.Join(absPath, "c*")) for _, file := range files { if isCmdDir(file) { - return filepath.Base(file) + return string(os.PathSeparator) + filepath.Base(file) } } - return "cmd" + return string(os.PathSeparator) + "cmd" } // isCmdDir checks if base of name is one of cmdDir.