Created
October 9, 2019 16:31
-
-
Save gergoszka/8fe853fe4c93335d77175337f45a1202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <map> | |
#include <iomanip> | |
#include <fstream> | |
#include <boost/filesystem.hpp> | |
#include <boost/filesystem/fstream.hpp> | |
#include <boost/program_options.hpp> | |
using std::cout; | |
using namespace boost::filesystem; | |
void read_acts ( path p) | |
{ | |
std::vector<path> v; | |
if ( is_regular_file ( p ) ) { | |
std::string ext ( ".java" ); | |
for (auto&& x : directory_iterator(p)) | |
{ | |
if ( !ext.compare ( extension ( p ) ) ) | |
{ | |
v.push_back(x.path()); | |
} | |
} | |
} else if ( is_directory ( p ) ) | |
for ( directory_entry & entry : boost::filesystem::directory_iterator ( p ) ) | |
read_acts ( entry.path()); | |
for (auto&& x : v) | |
cout << " " << x.filename() << '\n'; | |
} | |
int main ( int argc, char *argv[] ) | |
{ | |
if (argc < 2) | |
{ | |
cout << "Usage: tut4 path\n"; | |
return 1; | |
} | |
path p (argv[1]); | |
read_acts(p); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment