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

Method DirTree_f

neo/framework/FileSystem.cpp:1942–1978  ·  view source on GitHub ↗

================ idFileSystemLocal::DirTree_f ================ */

Source from the content-addressed store, hash-verified

1940================
1941*/
1942void idFileSystemLocal::DirTree_f( const idCmdArgs &args ) {
1943 idStr relativePath;
1944 idStr extension;
1945 idFileList *fileList;
1946 int i;
1947
1948 if ( args.Argc() < 2 || args.Argc() > 3 ) {
1949 common->Printf( "usage: dirtree <directory> [extension]\n" );
1950 return;
1951 }
1952
1953 if ( args.Argc() == 2 ) {
1954 relativePath = args.Argv( 1 );
1955 extension = "";
1956 }
1957 else {
1958 relativePath = args.Argv( 1 );
1959 extension = args.Argv( 2 );
1960 if ( extension[0] != '.' ) {
1961 common->Warning( "extension should have a leading dot" );
1962 }
1963 }
1964 relativePath.BackSlashesToSlashes();
1965 relativePath.StripTrailing( '/' );
1966
1967 common->Printf( "Listing of %s/*%s /s\n", relativePath.c_str(), extension.c_str() );
1968 common->Printf( "---------------\n" );
1969
1970 fileList = fileSystemLocal.ListFilesTree( relativePath, extension );
1971
1972 for ( i = 0; i < fileList->GetNumFiles(); i++ ) {
1973 common->Printf( "%s\n", fileList->GetFile( i ) );
1974 }
1975 common->Printf( "%d files\n", fileList->list.Num() );
1976
1977 fileSystemLocal.FreeFileList( fileList );
1978}
1979
1980/*
1981============

Callers

nothing calls this directly

Calls 11

ArgcMethod · 0.80
ArgvMethod · 0.80
StripTrailingMethod · 0.80
ListFilesTreeMethod · 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