diff options
author | Tim Angus <tim@ngus.net> | 2006-01-24 05:04:21 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2006-01-24 05:04:21 +0000 |
commit | 608a95f42c08146d7e85fa876476d98365339a32 (patch) | |
tree | bb413c295ce51aa6648090e9856c399989a5e2f4 /src/qcommon/files.c | |
parent | 470f5cc7203a148289d6ad6f0f5c7b4d80a48d50 (diff) |
* 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
Diffstat (limited to 'src/qcommon/files.c')
-rw-r--r-- | src/qcommon/files.c | 23 |
1 files changed, 23 insertions, 0 deletions
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 ); +} |