Merge pull request #332 from jpcy/cmd-arg-completion-fixes

Misc. command argument completion fixes
This commit is contained in:
Robert Beckebans 2016-07-04 23:20:41 +02:00 committed by GitHub
commit 05bb9da500
3 changed files with 9 additions and 3 deletions

View file

@ -191,6 +191,7 @@ public:
static void ArgCompletion_Decl( const idCmdArgs& args, void( *callback )( const char* s ) );
static void ArgCompletion_FileName( const idCmdArgs& args, void( *callback )( const char* s ) );
static void ArgCompletion_MapName( const idCmdArgs& args, void( *callback )( const char* s ) );
static void ArgCompletion_MapNameNoJson( const idCmdArgs& args, void( *callback )( const char* s ) );
static void ArgCompletion_ModelName( const idCmdArgs& args, void( *callback )( const char* s ) );
static void ArgCompletion_SoundName( const idCmdArgs& args, void( *callback )( const char* s ) );
static void ArgCompletion_ImageName( const idCmdArgs& args, void( *callback )( const char* s ) );
@ -236,6 +237,11 @@ ID_INLINE void idCmdSystem::ArgCompletion_FileName( const idCmdArgs& args, void(
}
ID_INLINE void idCmdSystem::ArgCompletion_MapName( const idCmdArgs& args, void( *callback )( const char* s ) )
{
cmdSystem->ArgCompletion_FolderExtension( args, callback, "maps/", true, ".map", ".json", NULL );
}
ID_INLINE void idCmdSystem::ArgCompletion_MapNameNoJson( const idCmdArgs& args, void( *callback )( const char* s ) )
{
cmdSystem->ArgCompletion_FolderExtension( args, callback, "maps/", true, ".map", NULL );
}

View file

@ -584,7 +584,7 @@ CONSOLE_COMMAND( exportMapToOBJ, "Convert .map file to .obj/.mtl ", idCmdSystem:
CONSOLE_COMMAND( convertMap, "Convert .map file to new map format with polygons instead of brushes ", idCmdSystem::ArgCompletion_MapName )
CONSOLE_COMMAND( convertMap, "Convert .map file to new map format with polygons instead of brushes ", idCmdSystem::ArgCompletion_MapNameNoJson )
{
common->SetRefreshOnPrint( true );
@ -627,7 +627,7 @@ CONSOLE_COMMAND( convertMap, "Convert .map file to new map format with polygons
}
CONSOLE_COMMAND( convertMapToJSON, "Convert .map file to new map format with polygons instead of brushes ", idCmdSystem::ArgCompletion_MapName )
CONSOLE_COMMAND( convertMapToJSON, "Convert .map file to new map format with polygons instead of brushes ", idCmdSystem::ArgCompletion_MapNameNoJson )
{
common->SetRefreshOnPrint( true );

View file

@ -2271,7 +2271,7 @@ int idFileSystemLocal::GetFileList( const char* relativePath, const idStrList& e
}
// ensure we have a path, and not just a filename containing the path
if( rt.filename[ pathLength ] == '\0' || rt.filename[pathLength - 1] != '/' )
if( rt.filename[ pathLength ] == '\0' || ( pathLength && rt.filename[pathLength - 1] != '/' ) )
{
continue;
}