Changeset - r10384:216e03c78d1d
[Not reviewed]
master
0 2 0
rubidium - 16 years ago 2008-11-26 01:07:49
rubidium@openttd.org
(svn r14635) -Change: use S_ISDIR/S_ISREG as x & S_IFREG always results false on platforms when S_IFREG is 0x0000.
2 files changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/fileio.cpp
Show inline comments
 
@@ -984,12 +984,12 @@ static uint ScanPath(FileScanner *fs, co
 

	
 
		snprintf(filename, lengthof(filename), "%s%s", path, d_name);
 

	
 
		if (sb.st_mode & S_IFDIR) {
 
		if (S_ISDIR(sb.st_mode)) {
 
			/* Directory */
 
			if (strcmp(d_name, ".") == 0 || strcmp(d_name, "..") == 0) continue;
 
			AppendPathSeparator(filename, lengthof(filename));
 
			num += ScanPath(fs, extension, filename, basepath_length);
 
		} else if (sb.st_mode & S_IFREG) {
 
		} else if (S_ISREG(sb.st_mode)) {
 
			/* File */
 
			char *ext = strrchr(filename, '.');
 

	
src/stdafx.h
Show inline comments
 
@@ -235,6 +235,11 @@
 
		#undef assert
 
		#define assert(expression) if (!(expression)) { SetExceptionString("Assertion failed at %s:%d: %s", __FILE__, __LINE__, #expression); *(byte*)0 = 0; }
 
	#endif
 

	
 
	/* MSVC doesn't have these :( */
 
	#define S_ISDIR(mode) (mode & S_IFDIR)
 
	#define S_ISREG(mode) (mode & S_IFREG)
 

	
 
#endif /* defined(_MSC_VER) */
 

	
 
#if defined(WINCE)
0 comments (0 inline, 0 general)