cmd/ebitenmobile: bug fix: the first character of a framework name must be an upper case

Updates #2192
This commit is contained in:
Hajime Hoshi 2022-07-09 18:30:38 +09:00
parent 7fdbb4a5d5
commit 4ba0ab6e3a

View File

@ -237,8 +237,12 @@ func doBind(args []string, flagset *flag.FlagSet, buildOS string) error {
continue continue
} }
frameworkName := filepath.Base(buildO) frameworkName := filepath.Base(buildO)
frameworkName = frameworkName[:len(frameworkName)-len(".xcframework")] + ".framework" frameworkNameBase := frameworkName[:len(frameworkName)-len(".xcframework")]
dir := filepath.Join(buildO, name, frameworkName, "Versions", "A") // The first character must be an upper case (#2192).
// TODO: strings.Title is used here for the consistency with gomobile (see cmd/gomobile/bind_iosapp.go).
// As strings.Title is deprecated, golang.org/x/text/cases should be used.
frameworkNameBase = strings.Title(frameworkNameBase)
dir := filepath.Join(buildO, name, frameworkNameBase+".framework", "Versions", "A")
if err := ioutil.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil { if err := ioutil.WriteFile(filepath.Join(dir, "Headers", prefixUpper+"EbitenViewController.h"), []byte(replacePrefixes(objcH)), 0644); err != nil {
return err return err