@@ -267,7 +267,8 @@ func GtagsBuildIndexStream(ctx context.Context, dir string, w io.Writer) error {
267267// Windows ではパイプバッファリングにより出力が遅延するため、5 秒ごとにハートビートを送る。
268268func GtagsUpdateIndexStream (ctx context.Context , dir string , w io.Writer ) error {
269269 cmd := exec .CommandContext (ctx , resolveGlobalBin (), "-u" , "-v" )
270- cmd .Env = englishEnv ("GTAGSDBPATH=" + dir , "GTAGSROOT=" + dir )
270+ gtagsPathU := filepath .ToSlash (dir )
271+ cmd .Env = englishEnv ("GTAGSDBPATH=" + gtagsPathU , "GTAGSROOT=" + gtagsPathU )
271272
272273 pr , pw := io .Pipe ()
273274 cmd .Stdout = pw
@@ -382,7 +383,9 @@ func GtagsFindDefinitions(ctx context.Context, word, dir string) ([]DefHit, erro
382383 // キャンセルされても結果はキャッシュに入るので次回即返せる。
383384 cmd := exec .CommandContext (context .Background (), globalBin , "-xd" , word )
384385 cmd .Dir = dir
385- env := append (os .Environ (), "GTAGSDBPATH=" + dir , "GTAGSROOT=" + dir )
386+ // MSYS2版 global.exe はバックスラッシュを解釈できないためフォワードスラッシュに変換する
387+ gtagsPath := filepath .ToSlash (dir )
388+ env := append (os .Environ (), "GTAGSDBPATH=" + gtagsPath , "GTAGSROOT=" + gtagsPath )
386389 cmd .Env = env
387390 if devNull , err := os .Open (os .DevNull ); err == nil {
388391 cmd .Stdin = devNull
@@ -855,7 +858,8 @@ func GtagsFindHoverHits(ctx context.Context, word, dir string) ([]DefHit, error)
855858func GtagsFindRefs (ctx context.Context , word , dir string ) ([]CallSite , error ) {
856859 cmd := exec .CommandContext (context .Background (), resolveGlobalBin (), "-xr" , word )
857860 cmd .Dir = dir
858- cmd .Env = append (os .Environ (), "GTAGSDBPATH=" + dir , "GTAGSROOT=" + dir )
861+ gtagsRefPath := filepath .ToSlash (dir )
862+ cmd .Env = append (os .Environ (), "GTAGSDBPATH=" + gtagsRefPath , "GTAGSROOT=" + gtagsRefPath )
859863 var stderr bytes.Buffer
860864 cmd .Stderr = & stderr
861865 out , err := cmd .Output ()
0 commit comments