File diff r2951:a52cbb930051 → r2952:e97f823d2dbe
fileio.c
Show inline comments
 
@@ -56,13 +56,13 @@ byte FioReadByte(void)
 
	}
 
	return *_fio.buffer++;
 
}
 

	
 
void FioSkipBytes(int n)
 
{
 
	for(;;) {
 
	for (;;) {
 
		int m = min(_fio.buffer_end - _fio.buffer, n);
 
		_fio.buffer += m;
 
		n -= m;
 
		if (n == 0) break;
 
		FioReadByte();
 
		n--;
 
@@ -114,21 +114,21 @@ bool FiosCheckFileExists(const char *fil
 

	
 
	f = fopen(buf, "rb");
 
#if !defined(WIN32)
 
	if (f == NULL) {
 
		char *s;
 
		// Make lower case and try again
 
		for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
 
		for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
 
			*s = tolower(*s);
 
		f = fopen(buf, "rb");
 

	
 
#if defined SECOND_DATA_DIR
 
	// tries in the 2nd data directory
 
		if (f == NULL) {
 
			sprintf(buf, "%s%s", _path.second_data_dir, filename);
 
			for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
 
			for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
 
			*s = tolower(*s);
 
		f = fopen(buf, "rb");
 
		}
 
#endif
 
	}
 
#endif
 
@@ -150,21 +150,21 @@ FILE *FioFOpenFile(const char *filename)
 

	
 
	f = fopen(buf, "rb");
 
#if !defined(WIN32)
 
	if (f == NULL) {
 
		char *s;
 
		// Make lower case and try again
 
		for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
 
		for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
 
			*s = tolower(*s);
 
		f = fopen(buf, "rb");
 

	
 
#if defined SECOND_DATA_DIR
 
		// tries in the 2nd data directory
 
		if (f == NULL) {
 
			sprintf(buf, "%s%s", _path.second_data_dir, filename);
 
			for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
 
			for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
 
				*s = tolower(*s);
 
			f = fopen(buf, "rb");
 
		}
 
#endif
 
	}
 
#endif
 
@@ -181,21 +181,21 @@ void FioOpenFile(int slot, const char *f
 

	
 
	f = fopen(buf, "rb");
 
#if !defined(WIN32)
 
	if (f == NULL) {
 
		char *s;
 
		// Make lower case and try again
 
		for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
 
		for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
 
			*s = tolower(*s);
 
		f = fopen(buf, "rb");
 

	
 
#if defined SECOND_DATA_DIR
 
	// tries in the 2nd data directory
 
		if (f == NULL) {
 
			sprintf(buf, "%s%s", _path.second_data_dir, filename);
 
			for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
 
			for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
 
			*s = tolower(*s);
 
		f = fopen(buf, "rb");
 
		}
 

	
 
	if (f == NULL)
 
		sprintf(buf, "%s%s", _path.data_dir, filename);	//makes it print the primary datadir path instead of the secundary one