@@ -167,15 +167,50 @@ def GetConfig(path_ini, section, key):
167167 lines = file .readlines ()
168168
169169 in_section = False
170+ target_section = section .strip ()
171+ target_key = key .strip ()
172+
170173 for line in lines :
171174 line = line .strip ()
172175 if line .startswith ('[' ) and line .endswith (']' ):
173- if line == section :
176+ # Case insensitive check for section
177+ if line .lower () == target_section .lower ():
174178 in_section = True
175179 else :
176180 in_section = False
177- elif in_section and line .startswith (key + '=' ):
178- return line .split ('=' , 1 )[1 ]
181+ elif in_section and '=' in line :
182+ # Handle possible spaces around =
183+ parts = line .split ('=' , 1 )
184+ current_key = parts [0 ].strip ()
185+ if current_key .lower () == target_key .lower ():
186+ return parts [1 ].strip ()
179187
180188 return None
181189
190+ @staticmethod
191+ def GetBundleIdentifier (path_ini , project_name ):
192+ # 1. Try IOS Runtime Settings
193+ bundle_id = UnrealConfigIniManager .GetConfig (path_ini , "[/Script/IOSRuntimeSettings.IOSRuntimeSettings]" , "BundleIdentifier" )
194+
195+ # 2. Try Mac Target Settings
196+ if not bundle_id :
197+ bundle_id = UnrealConfigIniManager .GetConfig (path_ini , "[/Script/MacTargetPlatform.XcodeProjectSettings]" , "BundleIdentifier" )
198+
199+ # 3. Check for Macros or Failure
200+ if not bundle_id or "$(" in bundle_id :
201+ # Resolve Prefix
202+ prefix = UnrealConfigIniManager .GetConfig (path_ini , "[/Script/IOSRuntimeSettings.IOSRuntimeSettings]" , "CodeSigningPrefix" )
203+ if not prefix :
204+ prefix = UnrealConfigIniManager .GetConfig (path_ini , "[/Script/MacTargetPlatform.XcodeProjectSettings]" , "CodeSigningPrefix" )
205+
206+ if not prefix :
207+ prefix = "io.agora"
208+
209+ # Construct ID
210+ bundle_id = f"{ prefix } .{ project_name } "
211+ PrintLog (f"UnrealConfigIniManager - Resolved Bundle ID from prefix: { bundle_id } " )
212+ else :
213+ PrintLog (f"UnrealConfigIniManager - Read Bundle ID: { bundle_id } " )
214+
215+ return bundle_id
216+
0 commit comments