@@ -29,11 +29,8 @@ const (
2929
3030var (
3131 regexpPhpFile = regexp .MustCompile (`(?://)?(/[^ ]*\.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- }
32+ regexpFilename__Win = regexp .MustCompile (`filename=["]?file:///(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php` )
33+ regexpFilename__Unix = regexp .MustCompile (`filename=["]?file://(\S+)/Data/Temporary/.+?/Cache/Code/Flow_Object_Classes/([^"]*)\.php` )
3734 regexpPathAndFilename = regexp .MustCompile (`(?m)^# PathAndFilename: (.*)$` )
3835 regexpPackageClass = regexp .MustCompile (`(.*?)/Packages/[^/]*/(.*?)/Classes/(.*).php` )
3936 regexpDot = regexp .MustCompile (`[\./]` )
@@ -44,6 +41,13 @@ func init() {
4441 pathmapperfactory .Register (framework , p )
4542}
4643
44+ func regexpFilename () * regexp.Regexp {
45+ if runtime .GOOS == "windows" {
46+ return regexpFilename__Win
47+ }
48+ return regexpFilename__Unix
49+ }
50+
4751// PathMapper handle the mapping between real code and proxy
4852type PathMapper struct {
4953 config * config.Config
@@ -112,7 +116,7 @@ func (p *PathMapper) getCachePath(base, filename string) string {
112116
113117func (p * PathMapper ) doXMLPathMapping (b []byte ) []byte {
114118 var processedMapping = map [string ]string {}
115- for _ , match := range regexpFilename .FindAllStringSubmatch (string (b ), - 1 ) {
119+ for _ , match := range regexpFilename () .FindAllStringSubmatch (string (b ), - 1 ) {
116120 path := p .getCachePath (match [1 ], match [2 ])
117121 if _ , ok := processedMapping [path ]; ok == false {
118122 if originalPath , exist := p .pathMapping .Get (path ); exist {
0 commit comments