File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -534,8 +534,35 @@ func GetCanonicalFileName(fileName string, useCaseSensitiveFileNames bool) strin
534534// they have corresponding upper case character so they dont need special handling
535535
536536func ToFileNameLowerCase (fileName string ) string {
537+ const IWithDot = '\u0130'
538+
539+ ascii := true
540+ needsLower := false
541+ for _ , c := range []byte (fileName ) {
542+ if c >= 0x80 {
543+ ascii = false
544+ break
545+ }
546+ if 'A' <= c && c <= 'Z' {
547+ needsLower = true
548+ }
549+ }
550+ if ascii {
551+ if ! needsLower {
552+ return fileName
553+ }
554+ b := make ([]byte , len (fileName ))
555+ for i , c := range []byte (fileName ) {
556+ if 'A' <= c && c <= 'Z' {
557+ c += 'a' - 'A' // +32
558+ }
559+ b [i ] = c
560+ }
561+ return string (b )
562+ }
563+
537564 return strings .Map (func (r rune ) rune {
538- if r == '\u0130' {
565+ if r == IWithDot {
539566 return r
540567 }
541568 return unicode .ToLower (r )
You can’t perform that action at this time.
0 commit comments