MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Dir_f

Method Dir_f

neo/framework/FileSystem.cpp:1899–1935  ·  view source on GitHub ↗

================ idFileSystemLocal::Dir_f ================ */

Source from the content-addressed store, hash-verified

1897================
1898*/
1899void idFileSystemLocal::Dir_f( const idCmdArgs &args ) {
1900 idStr relativePath;
1901 idStr extension;
1902 idFileList *fileList;
1903 int i;
1904
1905 if ( args.Argc() < 2 || args.Argc() > 3 ) {
1906 common->Printf( "usage: dir <directory> [extension]\n" );
1907 return;
1908 }
1909
1910 if ( args.Argc() == 2 ) {
1911 relativePath = args.Argv( 1 );
1912 extension = "";
1913 }
1914 else {
1915 relativePath = args.Argv( 1 );
1916 extension = args.Argv( 2 );
1917 if ( extension[0] != '.' ) {
1918 common->Warning( "extension should have a leading dot" );
1919 }
1920 }
1921 relativePath.BackSlashesToSlashes();
1922 relativePath.StripTrailing( '/' );
1923
1924 common->Printf( "Listing of %s/*%s\n", relativePath.c_str(), extension.c_str() );
1925 common->Printf( "---------------\n" );
1926
1927 fileList = fileSystemLocal.ListFiles( relativePath, extension );
1928
1929 for ( i = 0; i < fileList->GetNumFiles(); i++ ) {
1930 common->Printf( "%s\n", fileList->GetFile( i ) );
1931 }
1932 common->Printf( "%d files\n", fileList->list.Num() );
1933
1934 fileSystemLocal.FreeFileList( fileList );
1935}
1936
1937/*
1938================

Callers

nothing calls this directly

Calls 11

ArgcMethod · 0.80
ArgvMethod · 0.80
StripTrailingMethod · 0.80
ListFilesMethod · 0.80
GetNumFilesMethod · 0.80
GetFileMethod · 0.80
FreeFileListMethod · 0.80
PrintfMethod · 0.45
WarningMethod · 0.45
c_strMethod · 0.45
NumMethod · 0.45

Tested by

no test coverage detected