diff --git a/core/core.go b/core/core.go index 5706001a..80529311 100644 --- a/core/core.go +++ b/core/core.go @@ -41,15 +41,20 @@ func UniqueInts(a []int, sorted bool) []int { return uniq } -func CommaSplit(csv string) []string { +func SepSplit(sv string, sep string) []string { filtered := make([]string, 0) - for _, part := range strings.Split(csv, ",") { + for _, part := range strings.Split(sv, sep) { part = Trim(part) if part != "" { filtered = append(filtered, part) } } return filtered + +} + +func CommaSplit(csv string) []string { + return SepSplit(csv, ",") } func ExecSilent(executable string, args []string) (string, error) { diff --git a/session/session.go b/session/session.go index d77e6c3b..1f3b26b8 100644 --- a/session/session.go +++ b/session/session.go @@ -484,11 +484,8 @@ func (s *Session) isCapletCommand(line string) (is bool, filename string, argv [ } capspath := core.Trim(os.Getenv("CAPSPATH")) - for _, folder := range strings.Split(capspath, ":") { - folder = core.Trim(folder) - if folder != "" { - paths = append(paths, folder) - } + for _, folder := range core.SepSplit(capspath, ":") { + paths = append(paths, folder) } file := core.Trim(line)