================ idFileSystemLocal::Dir_f ================ */
| 1897 | ================ |
| 1898 | */ |
| 1899 | void 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 | ================ |
nothing calls this directly
no test coverage detected