package builder import ( "fmt" "os" "path/filepath" "strings" ) func (h *Handler) buildDarwinAppBundle(outDir, title, runnerPath string, p BuildPlatform) error { appName := sanitizeFileName(strings.TrimSuffix(filepath.Base(title), filepath.Ext(title))) + ".app" if appName == ".app" { appName = "Movie.app" } appDir := filepath.Join(outDir, appName) macosDir := filepath.Join(appDir, "Contents", "MacOS") if err := os.MkdirAll(macosDir, 0755); err != nil { return err } dest := filepath.Join(macosDir, "runner") if err := copyFile(runnerPath, dest); err != nil { return err } _ = os.Chmod(dest, 0755) name := strings.TrimSuffix(filepath.Base(title), filepath.Ext(title)) plist := fmt.Sprintf(` CFBundleName%s CFBundleExecutablerunner CFBundleIdentifiercom.aetherforge.%s LSUIElement `, name, sanitizeFileName(title)) return os.WriteFile(filepath.Join(appDir, "Contents", "Info.plist"), []byte(plist), 0644) }