summaryrefslogtreecommitdiffstats
path: root/recursive.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:40:27 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:40:27 +0000
commit6c7f7b2ed08fa742632ec389c9c7852e629c7bf2 (patch)
tree4066f3bf05144af754b8e725096e98bfc3339ac3 /recursive.cc
parentAdding upstream version 1.3. (diff)
downloadzutils-6c7f7b2ed08fa742632ec389c9c7852e629c7bf2.tar.xz
zutils-6c7f7b2ed08fa742632ec389c9c7852e629c7bf2.zip
Adding upstream version 1.4~pre2.upstream/1.4_pre2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'recursive.cc')
-rw-r--r--recursive.cc11
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;