- if ( (argv[i][0] == '-') && (argv[i][1] == 'L') )
- libraryPaths.push_back(&argv[i][2]);
- else if ( (argv[i][0] == '-') && (argv[i][1] == 'F') )
- frameworkPaths.push_back(&argv[i][2]);
+ if ( (argv[i][0] == '-') && (argv[i][1] == 'L') ) {
+ const char* libSearchDir = &argv[i][2];
+ if ( libSearchDir[0] == '\0' )
+ throw "-L must be immediately followed by a directory path (no space)";
+ struct stat statbuf;
+ if ( stat(libSearchDir, &statbuf) == 0 ) {
+ if ( statbuf.st_mode & S_IFDIR )
+ libraryPaths.push_back(libSearchDir);
+ else
+ warning("path '%s' following -L not a directory", libSearchDir);
+ }
+ else {
+ warning("directory '%s' following -L not found", libSearchDir);
+ }
+ }
+ else if ( (argv[i][0] == '-') && (argv[i][1] == 'F') ) {
+ const char* frameworkSearchDir = &argv[i][2];
+ if ( frameworkSearchDir[0] == '\0' )
+ throw "-F must be immediately followed by a directory path (no space)";
+ struct stat statbuf;
+ if ( stat(frameworkSearchDir, &statbuf) == 0 ) {
+ if ( statbuf.st_mode & S_IFDIR )
+ frameworkPaths.push_back(frameworkSearchDir);
+ else
+ warning("path '%s' following -F not a directory", frameworkSearchDir);
+ }
+ else {
+ warning("directory '%s' following -F not found", frameworkSearchDir);
+ }
+ }