Sophie

Sophie

distrib > Fedora > 13 > x86_64 > by-pkgid > 08163ffb50475ea8ee1ba869af0dfe3e > files > 7

quake3-1.36-8.svn1802.fc13.src.rpm

From: Simon McVittie <smcv@debian.org>
Date: Wed, 21 Jul 2010 23:01:46 +0100
Subject: [PATCH] FS_FindDll: new function to go through the search path looking for a DLL

Origin: vendor, Debian
Bug: http://bugzilla.icculus.org/show_bug.cgi?id=4701
Forwarded: yes
---
 code/qcommon/files.c   |   26 ++++++++++++++++++++++++++
 code/qcommon/qcommon.h |    3 +++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/code/qcommon/files.c b/code/qcommon/files.c
index 9e76a0b..c52e113 100644
--- a/code/qcommon/files.c
+++ b/code/qcommon/files.c
@@ -1218,6 +1218,32 @@ int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueF
 }
 
 
+char *FS_FindDll( const char *filename ) {
+	searchpath_t	*search;
+	directory_t		*dir;
+
+	if ( !fs_searchpaths ) {
+		Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
+	}
+
+	for ( search = fs_searchpaths ; search ; search = search->next ) {
+		if ( search->dir ) {
+			FILE *f;
+			char *netpath;
+
+			dir = search->dir;
+			netpath = FS_BuildOSPath( dir->path, dir->gamedir, filename );
+			f = fopen( netpath, "rb" );
+			if (f) {
+				fclose( f );
+				return netpath;
+			}
+		}
+	}
+
+	return NULL;
+}
+
 /*
 =================
 FS_Read
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index 6698454..30ab601 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -605,6 +605,9 @@ void	FS_FreeFileList( char **list );
 qboolean FS_FileExists( const char *file );
 
 qboolean FS_CreatePath (char *OSPath);
+
+char *FS_FindDll( const char *filename );
+
 char   *FS_BuildOSPath( const char *base, const char *game, const char *qpath );
 qboolean FS_CompareZipChecksum(const char *zipfile);
 
--