Changeset - r11253:859882bdf5aa
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-03-04 00:19:42
rubidium@openttd.org
(svn r15607) -Codechange: support searching files without filtering on extension.
1 file changed with 13 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/fileio.cpp
Show inline comments
 
@@ -1049,11 +1049,13 @@ static uint ScanPath(FileScanner *fs, co
 
			num += ScanPath(fs, extension, filename, basepath_length, recursive);
 
		} else if (S_ISREG(sb.st_mode)) {
 
			/* File */
 
			char *ext = strrchr(filename, '.');
 
			if (extension != NULL) {
 
				char *ext = strrchr(filename, '.');
 

	
 
			/* If no extension or extension isn't .grf, skip the file */
 
			if (ext == NULL) continue;
 
			if (strcasecmp(ext, extension) != 0) continue;
 
				/* If no extension or extension isn't .grf, skip the file */
 
				if (ext == NULL) continue;
 
				if (strcasecmp(ext, extension) != 0) continue;
 
			}
 

	
 
			if (fs->AddFile(filename, basepath_length)) num++;
 
		}
 
@@ -1073,11 +1075,14 @@ static uint ScanTar(FileScanner *fs, con
 
{
 
	uint num = 0;
 
	const char *filename = (*tar).first.c_str();
 
	const char *ext = strrchr(filename, '.');
 

	
 
	if (extension != NULL) {
 
		const char *ext = strrchr(filename, '.');
 

	
 
	/* If no extension or extension isn't .grf, skip the file */
 
	if (ext == NULL) return false;
 
	if (strcasecmp(ext, extension) != 0) return false;
 
		/* If no extension or extension isn't .grf, skip the file */
 
		if (ext == NULL) return false;
 
		if (strcasecmp(ext, extension) != 0) return false;
 
	}
 

	
 
	if (fs->AddFile(filename, 0)) num++;
 

	
0 comments (0 inline, 0 general)