@@ -162,6 +162,28 @@ - (id)getRootWithSimRuntime: (id)runtime
162162
163163// //////////////////////////////////////////////////////////////////////////////
164164
165+ int getXcodeVersion (char *path_to_developer_folder)
166+ {
167+ NSBundle *t_xcode_bundle = nil ;
168+ NSString *t_xcode_path = [NSString stringWithFormat: @" %s /../../" , path_to_developer_folder];
169+
170+ t_xcode_bundle = [NSBundle bundleWithPath: t_xcode_path];
171+
172+ NSString *t_xcode_version_string = [[t_xcode_bundle infoDictionary ] objectForKey: @" CFBundleShortVersionString" ];
173+ NSArray *t_xcode_version_array = [t_xcode_version_string componentsSeparatedByString: @" ." ];
174+
175+ int t_xcode_version;
176+ t_xcode_version = [[t_xcode_version_array objectAtIndex: 0 ] intValue ] * 100 ;
177+ t_xcode_version += [[t_xcode_version_array objectAtIndex: 1 ] intValue ] * 10 ;
178+
179+ if ([t_xcode_version_array count ] == 3 )
180+ {
181+ t_xcode_version += [[t_xcode_version_array objectAtIndex: 2 ] intValue ];
182+ }
183+
184+ return t_xcode_version;
185+ }
186+
165187int main (int argc, char *argv[])
166188{
167189 bool t_success;
@@ -215,22 +237,29 @@ int main(int argc, char *argv[])
215237
216238 // NSLog(@"DVTFoundation %d", t_success);
217239 }
218-
219- NSBundle *t_dev_tools_bundle;
220- t_dev_tools_bundle = nil ;
221- if (t_success)
222- {
223- NSString *t_dev_tools_path;
224- t_dev_tools_path = [NSString stringWithFormat: @" %s /../OtherFrameworks/DevToolsFoundation.framework" , argv[1 ]];
225-
226- if (![[NSFileManager defaultManager ] fileExistsAtPath: t_dev_tools_path])
227- t_dev_tools_path = [NSString stringWithFormat: @" %s /Library/PrivateFrameworks/DevToolsFoundation.framework" , argv[1 ]];
228-
229- t_dev_tools_bundle = [NSBundle bundleWithPath: t_dev_tools_path];
230- t_success = [t_dev_tools_bundle load ];
231-
232- // NSLog(@"DevTools %d", t_success);
233- }
240+
241+ int t_xcode_version = getXcodeVersion (argv[1 ]);
242+
243+ // In Xcode 8.3 the Xcode.app/Contents/OtherFrameworks/DevToolsFoundation.framework is no longer present
244+ // In fact it is not needed anyway
245+ if (t_xcode_version < 830 )
246+ {
247+ NSBundle *t_dev_tools_bundle;
248+ t_dev_tools_bundle = nil ;
249+ if (t_success)
250+ {
251+ NSString *t_dev_tools_path;
252+ t_dev_tools_path = [NSString stringWithFormat: @" %s /../OtherFrameworks/DevToolsFoundation.framework" , argv[1 ]];
253+
254+ if (![[NSFileManager defaultManager ] fileExistsAtPath: t_dev_tools_path])
255+ t_dev_tools_path = [NSString stringWithFormat: @" %s /Library/PrivateFrameworks/DevToolsFoundation.framework" , argv[1 ]];
256+
257+ t_dev_tools_bundle = [NSBundle bundleWithPath: t_dev_tools_path];
258+ t_success = [t_dev_tools_bundle load ];
259+
260+ // NSLog(@"DevTools %d", t_success);
261+ }
262+ }
234263
235264 if (t_success)
236265 {
0 commit comments