mirror of
https://github.com/spf13/cobra
synced 2025-05-06 05:17:21 +00:00
add os.PathSeparator to the return value of findCmdDir func
This commit is contained in:
parent
cd30c2a7e9
commit
1f2154738b
1 changed files with 4 additions and 4 deletions
|
@ -134,21 +134,21 @@ func (p *Project) CmdPath() string {
|
||||||
// looks for existing cmd dir in absPath.
|
// looks for existing cmd dir in absPath.
|
||||||
func findCmdDir(absPath string) string {
|
func findCmdDir(absPath string) string {
|
||||||
if !exists(absPath) || isEmpty(absPath) {
|
if !exists(absPath) || isEmpty(absPath) {
|
||||||
return "cmd"
|
return string(os.PathSeparator) + "cmd"
|
||||||
}
|
}
|
||||||
|
|
||||||
if isCmdDir(absPath) {
|
if isCmdDir(absPath) {
|
||||||
return filepath.Base(absPath)
|
return string(os.PathSeparator) + filepath.Base(absPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
files, _ := filepath.Glob(filepath.Join(absPath, "c*"))
|
files, _ := filepath.Glob(filepath.Join(absPath, "c*"))
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if isCmdDir(file) {
|
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.
|
// isCmdDir checks if base of name is one of cmdDir.
|
||||||
|
|
Loading…
Add table
Reference in a new issue