--- src/eixTk/utils.cc +++ src/eixTk/utils.cc @@ -43,7 +43,7 @@ using namespace std; /** push_back every line of file into v. */ -bool pushback_lines(const char *file, vector *v, bool removed_empty) +bool pushback_lines_file(const char *file, vector *v, bool removed_empty) { string line; ifstream ifstr(file); @@ -71,6 +71,28 @@ return false; } +/** push_back every line of file or dir into v. */ +bool pushback_lines(const char *file_dir, vector *v, bool removed_empty) +{ + static const char *files_exclude[] = { "..", "." , NULL }; + vector files; + string dir(file_dir); + dir += "/"; + if(pushback_files(dir, files, files_exclude)) + { + bool rvalue=true; + for(vector::iterator it=files.begin(); + itc_str(), v, removed_empty)) + rvalue=false; + } + return rvalue; + } + else + return pushback_lines_file(file_dir, v, removed_empty); +} + /** List of files in directory. * Pushed names of file in directory into string-vector if the don't match any * char * in given exlude list.