MCPcopy Create free account
hub / github.com/auth0/auth0-cli / readIOSBundleID

Function readIOSBundleID

internal/cli/quickstart_detect.go:524–550  ·  view source on GitHub ↗

readIOSBundleID reads the bundle ID from iOS project files (pbxproj then Info.plist).

(dir string)

Source from the content-addressed store, hash-verified

522
523// readIOSBundleID reads the bundle ID from iOS project files (pbxproj then Info.plist).
524func readIOSBundleID(dir string) string {
525 // Flutter path.
526 if data, err := os.ReadFile(filepath.Join(dir, "ios", "Runner.xcodeproj", "project.pbxproj")); err == nil {
527 if id := extractPbxprojBundleID(string(data)); id != "" {
528 return id
529 }
530 }
531 // Native Xcode projects place the .xcodeproj at the root of the repo.
532 if entries, err := os.ReadDir(dir); err == nil {
533 for _, e := range entries {
534 if e.IsDir() && strings.HasSuffix(e.Name(), ".xcodeproj") {
535 pbx := filepath.Join(dir, e.Name(), "project.pbxproj")
536 if data, err := os.ReadFile(pbx); err == nil {
537 if id := extractPbxprojBundleID(string(data)); id != "" {
538 return id
539 }
540 }
541 }
542 }
543 }
544 if data, err := os.ReadFile(filepath.Join(dir, "ios", "Runner", "Info.plist")); err == nil {
545 if id := extractInfoPlistBundleID(string(data)); id != "" {
546 return id
547 }
548 }
549 return ""
550}
551
552// pbxprojBundleIDRegex matches PRODUCT_BUNDLE_IDENTIFIER = com.example.app; in project.pbxproj.
553var pbxprojBundleIDRegex = regexp.MustCompile(`PRODUCT_BUNDLE_IDENTIFIER\s*=\s*([a-zA-Z][a-zA-Z0-9._-]*)\s*;`)

Callers 4

TestReadIOSBundleIDFunction · 0.85
DetectProjectFunction · 0.85
readMobileBundleIDFunction · 0.85

Calls 2

extractPbxprojBundleIDFunction · 0.85
extractInfoPlistBundleIDFunction · 0.85

Tested by 2

TestReadIOSBundleIDFunction · 0.68