terminal: correctly gueses path separator used in source files paths (#1418)

Fixes an error in wrongly appending os.PathSeparator to source file path on Windows in case of path substitution config option.
This commit is contained in:
zavla 2018-11-27 23:42:21 +02:00 committed by Derek Parker
parent 53957e9f4d
commit c7399ac278

@ -264,7 +264,14 @@ func (t *Term) substitutePath(path string) string {
if t.conf == nil { if t.conf == nil {
return path return path
} }
separator := string(os.PathSeparator)
// On windows paths returned from headless server are as c:/dir/dir
// though os.PathSeparator is '\\'
separator := "/" //make it default
if strings.Index(path, "\\") != -1 { //dependent on the path
separator = "\\"
}
for _, r := range t.conf.SubstitutePath { for _, r := range t.conf.SubstitutePath {
from := crossPlatformPath(r.From) from := crossPlatformPath(r.From)
to := r.To to := r.To