src/fileio.cpp
changeset 10384 6b408b83ac34
parent 10310 ca2eb5811a07
child 10385 4f9838649c7f
equal deleted inserted replaced
10383:7aee0e95303f 10384:6b408b83ac34
   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;