Skip to content

Commit a446e67

Browse files
committed
TASK: Support Windows path
1 parent c199e77 commit a446e67

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

flowpathmapper/flowpathmapper.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"regexp"
1919
"strconv"
2020
"strings"
21+
"runtime"
2122
)
2223

2324
const (
@@ -28,7 +29,11 @@ const (
2829

2930
var (
3031
regexpPhpFile = regexp.MustCompile(`(?://)?(/[^ ]*\.php)`)
31-
regexpFilename = regexp.MustCompile(`filename=["]?file://(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php`)
32+
if runtime.GOOS == "windows" {
33+
regexpFilename = regexp.MustCompile(`filename=["]?file:///(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php`)
34+
} else
35+
regexpFilename = regexp.MustCompile(`filename=["]?file://(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php`)
36+
}
3237
regexpPathAndFilename = regexp.MustCompile(`(?m)^# PathAndFilename: (.*)$`)
3338
regexpPackageClass = regexp.MustCompile(`(.*?)/Packages/[^/]*/(.*?)/Classes/(.*).php`)
3439
regexpDot = regexp.MustCompile(`[\./]`)
@@ -78,6 +83,9 @@ func (p *PathMapper) doTextPathMapping(message []byte) []byte {
7883
var processedMapping = map[string]string{}
7984
for _, match := range regexpPhpFile.FindAllStringSubmatch(string(message), -1) {
8085
originalPath := match[1]
86+
if runtime.GOOS == "windows" {
87+
originalPath = strings.Replace(originalPath,"//","", 1)
88+
}
8189
path := p.mapPath(originalPath)
8290
p.logger.Debug("doTextPathMapping %s >>> %s", path, originalPath)
8391
processedMapping[path] = originalPath

0 commit comments

Comments
 (0)