Update parser_windows.go

Use filepath.IsAbs instead of path.IsAbs for Windows; convert paths to lowercase when normalizing them
This commit is contained in:
Dan Field
2017-07-26 11:08:51 -04:00
committed by GitHub
parent 2f5df55504
commit 01d6457c01
+5 -2
View File
@@ -4,15 +4,18 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"strings"
)
func normalizePath(path string) string {
return strings.Replace(path, "\\", "/", -1)
// use lower case, as Windows file systems will almost always be case insensitive
return strings.ToLower(strings.Replace(path, "\\", "/", -1))
}
func getPkgPath(fname string, isDir bool) (string, error) {
if !path.IsAbs(fname) {
// path.IsAbs doesn't work properly on Windows; use filepath.IsAbs instead
if !filepath.IsAbs(fname) {
pwd, err := os.Getwd()
if err != nil {
return "", err