982 |
982 |
983 if (!FiosIsValidFile(path, dirent, &sb)) continue; |
983 if (!FiosIsValidFile(path, dirent, &sb)) continue; |
984 |
984 |
985 snprintf(filename, lengthof(filename), "%s%s", path, d_name); |
985 snprintf(filename, lengthof(filename), "%s%s", path, d_name); |
986 |
986 |
987 if (sb.st_mode & S_IFDIR) { |
987 if (S_ISDIR(sb.st_mode)) { |
988 /* Directory */ |
988 /* Directory */ |
989 if (strcmp(d_name, ".") == 0 || strcmp(d_name, "..") == 0) continue; |
989 if (strcmp(d_name, ".") == 0 || strcmp(d_name, "..") == 0) continue; |
990 AppendPathSeparator(filename, lengthof(filename)); |
990 AppendPathSeparator(filename, lengthof(filename)); |
991 num += ScanPath(fs, extension, filename, basepath_length); |
991 num += ScanPath(fs, extension, filename, basepath_length); |
992 } else if (sb.st_mode & S_IFREG) { |
992 } else if (S_ISREG(sb.st_mode)) { |
993 /* File */ |
993 /* File */ |
994 char *ext = strrchr(filename, '.'); |
994 char *ext = strrchr(filename, '.'); |
995 |
995 |
996 /* If no extension or extension isn't .grf, skip the file */ |
996 /* If no extension or extension isn't .grf, skip the file */ |
997 if (ext == NULL) continue; |
997 if (ext == NULL) continue; |