@@ -314,19 +314,26 @@ CFStringRef copy_find_path(CFStringRef rootPath, CFStringRef namePattern) {
314
314
CFStringRef copy_xcode_dev_path (void ) {
315
315
static char xcode_dev_path[256 ] = { ' \0 ' };
316
316
if (strlen (xcode_dev_path) == 0 ) {
317
- FILE *fpipe = NULL ;
318
- char *command = " xcode-select -print-path" ;
317
+ const char * env_dev_path = getenv (" DEVELOPER_DIR" );
318
+
319
+ if (env_dev_path && strlen (env_dev_path) > 0 ) {
320
+ strcpy (xcode_dev_path, env_dev_path);
321
+ } else {
322
+ FILE *fpipe = NULL ;
323
+ char *command = " xcode-select -print-path" ;
319
324
320
- if (!(fpipe = (FILE *)popen (command, " r" )))
321
- on_sys_error (@" Error encountered while opening pipe" );
325
+ if (!(fpipe = (FILE *)popen (command, " r" )))
326
+ on_sys_error (@" Error encountered while opening pipe" );
322
327
323
- char buffer[256 ] = { ' \0 ' };
328
+ char buffer[256 ] = { ' \0 ' };
324
329
325
- fgets (buffer, sizeof (buffer), fpipe);
326
- pclose (fpipe);
330
+ fgets (buffer, sizeof (buffer), fpipe);
331
+ pclose (fpipe);
327
332
328
- strtok (buffer, " \n " );
329
- strcpy (xcode_dev_path, buffer);
333
+ strtok (buffer, " \n " );
334
+ strcpy (xcode_dev_path, buffer);
335
+ }
336
+ NSLogVerbose (@" Found Xcode developer dir %s " , xcode_dev_path);
330
337
}
331
338
return CFStringCreateWithCString (NULL , xcode_dev_path, kCFStringEncodingUTF8 );
332
339
}
0 commit comments