Skip to content

Commit

Permalink
modules: fix appkit header filename, improve TrimPrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
progrium committed Jun 13, 2024
1 parent d0e4a66 commit af69b89
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions generate/modules/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package modules
import (
"log"
"strings"
"unicode"
)

// Module Objective-c module
Expand Down Expand Up @@ -36,7 +37,7 @@ func TrimPrefix(symbolName string) string {
if len(prefix) == len(symbolName) {
continue
}
if strings.HasPrefix(symbolName, prefix) {
if strings.HasPrefix(symbolName, prefix) && unicode.IsUpper(rune(symbolName[len(prefix)])) {
name := strings.TrimPrefix(symbolName, prefix)
if strings.HasPrefix(symbolName, "k") {
return "K" + name
Expand Down Expand Up @@ -115,7 +116,7 @@ var All = []Module{
{"Kernel", "Kernel", "kernel", "Kernel/Kernel.h", []string{}},

{"Foundation", "Foundation", "foundation", "Foundation/Foundation.h", []string{"NS"}},
{"AppKit", "AppKit", "appkit", "Appkit/Appkit.h", []string{"NS"}},
{"AppKit", "AppKit", "appkit", "AppKit/AppKit.h", []string{"NS"}},
{"UIKit", "UIKit", "uikit", "UIKit/UIKit.h", []string{"NS"}},
{"UniformTypeIdentifiers", "Uniform Type Identifiers", "uti", "UniformTypeIdentifiers/UniformTypeIdentifiers.h", []string{"UT"}},
{"WebKit", "WebKit", "webkit", "WebKit/WebKit.h", []string{"WK"}},
Expand Down

0 comments on commit af69b89

Please sign in to comment.