diff options
Diffstat (limited to 'recursive.cc')
-rw-r--r-- | recursive.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/recursive.cc b/recursive.cc index 8c39121..9c98362 100644 --- a/recursive.cc +++ b/recursive.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2014 Antonio Diaz Diaz. + Copyright (C) 2009-2015 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,9 +46,12 @@ bool next_filename( std::list< std::string > & filenames, { const struct dirent * const entryp = readdir( dirp ); if( !entryp ) { closedir( dirp ); break; } - std::string tmp_name( entryp->d_name ); - if( tmp_name != "." && tmp_name != ".." ) - tmp_list.push_back( input_filename + "/" + tmp_name ); + const std::string tmp_name( entryp->d_name ); + if( tmp_name == "." || tmp_name == ".." ) continue; + const std::string full_name( input_filename + "/" + tmp_name ); + if( enabled_format( extension_format( extension_index( tmp_name ) ) ) || + ( stat( full_name.c_str(), &st ) == 0 && S_ISDIR( st.st_mode ) ) ) + tmp_list.push_back( full_name ); } filenames.splice( filenames.begin(), tmp_list ); continue; |