From 608a95f42c08146d7e85fa876476d98365339a32 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Tue, 24 Jan 2006 05:04:21 +0000 Subject: * Merged ioq3-r522 - i586 is now default -march - Couple of OpenAL "bug" fixes - Fancy autocompletion - Delete key on *nix fixed - Client now sleeps when inactive - Persistent console history --- src/qcommon/files.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/qcommon/files.c') diff --git a/src/qcommon/files.c b/src/qcommon/files.c index 14db75c7..b24b36fd 100644 --- a/src/qcommon/files.c +++ b/src/qcommon/files.c @@ -3361,3 +3361,26 @@ void FS_Flush( fileHandle_t f ) { fflush(fsh[f].handleFiles.file.o); } +void FS_FilenameCompletion( const char *dir, const char *ext, + qboolean stripExt, void(*callback)(const char *s) ) { + char **filenames; + int nfiles; + int i; + char filename[ MAX_STRING_CHARS ]; + + filenames = FS_ListFilteredFiles( dir, ext, NULL, &nfiles ); + + FS_SortFileList( filenames, nfiles ); + + for( i = 0; i < nfiles; i++ ) { + FS_ConvertPath( filenames[ i ] ); + Q_strncpyz( filename, filenames[ i ], MAX_STRING_CHARS ); + + if( stripExt ) { + COM_StripExtension( filename, filename ); + } + + callback( filename ); + } + FS_FreeFileList( filenames ); +} -- cgit