77#include <sys/syslimits.h>
88#include <unistd.h>
99
10+ __attribute__((noreturn ))
11+ __attribute__((__format__ (__printf__ , 1 , 0 ))) static void
12+ fail (const char * error , ...) {
13+ va_list args ;
14+ va_start (args , error );
15+ vfprintf (stderr , error , args );
16+ va_end (args );
17+ exit (EXIT_FAILURE );
18+ }
19+
1020static int (* extract )(const char * cache_path , const char * output_path ,
1121 void (^progress )(int , int ));
1222
1323static int get_library_path (const char * candidate , char * output ) {
1424 if (candidate ) {
25+ if (access (candidate , R_OK ) != 0 ) {
26+ fail ("error: dsc_extractor.bundle not found at provided path: %s\n" ,
27+ candidate );
28+ }
29+
1530 strncpy (output , candidate , PATH_MAX );
1631 return 0 ;
1732 }
@@ -33,16 +48,6 @@ static int get_library_path(const char *candidate, char *output) {
3348 return 1 ;
3449}
3550
36- __attribute__((noreturn ))
37- __attribute__((__format__ (__printf__ , 1 , 0 ))) static void
38- fail (const char * error , ...) {
39- va_list args ;
40- va_start (args , error );
41- vfprintf (stderr , error , args );
42- va_end (args );
43- exit (EXIT_FAILURE );
44- }
45-
4651static int extract_shared_cache (const char * library_path ,
4752 const char * cache_path ,
4853 const char * output_path ) {
@@ -71,9 +76,9 @@ int main(int argc, char *argv[]) {
7176 if (access (shared_cache , R_OK ) != 0 )
7277 fail ("error: shared cache path doesn't exist: %s\n" , shared_cache );
7378
74- const char * libraryCandidate = argc == 4 ? argv [3 ] : NULL ;
79+ const char * library_candidate = argc == 4 ? argv [3 ] : NULL ;
7580 char library_path [PATH_MAX ];
76- if (get_library_path (libraryCandidate , library_path ) != 0 )
81+ if (get_library_path (library_candidate , library_path ) != 0 )
7782 fail ("error: failed to fetch Xcode path\n" );
7883
7984 if (access (library_path , R_OK ) != 0 )
0 commit comments