mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user