summaryrefslogtreecommitdiffstats
path: root/recursive.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:40:35 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-08 04:40:35 +0000
commitf7deb94049481143ef12eab590840d39aecedc14 (patch)
tree9ff4090b78d8343fd073ba1ea32068bb0d07caa6 /recursive.cc
parentAdding debian version 1.3-4. (diff)
downloadzutils-f7deb94049481143ef12eab590840d39aecedc14.tar.xz
zutils-f7deb94049481143ef12eab590840d39aecedc14.zip
Merging upstream version 1.4~pre2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-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;