comparison srogue/main.c @ 189:7c552cbc6ad9

srogue: make checking directories slightly more portable. MSVC sys/stat.h doesn't define S_ISDIR().
author John "Elwin" Edwards
date Mon, 03 Aug 2015 09:05:15 -0400
parents db1c9a21a7c3
children 3de8058dd549
comparison
equal deleted inserted replaced
188:135ec7f15ffe 189:7c552cbc6ad9
436 directory_exists(char *dirname) 436 directory_exists(char *dirname)
437 { 437 {
438 struct stat sb; 438 struct stat sb;
439 439
440 if (stat(dirname, &sb) == 0) /* path exists */ 440 if (stat(dirname, &sb) == 0) /* path exists */
441 return (S_ISDIR (sb.st_mode)); 441 return ((sb.st_mode & S_IFMT) == S_IFDIR);
442 442
443 return(0); 443 return(0);
444 } 444 }
445 445
446 char * 446 char *