#include #include #include #include #include namespace fs = boost::filesystem; class dir_circulation { public : std::string root; std::string filename = "hacked.txt"; void MakeFile(std::string); int circulation(std::string); }; int dir_circulation::circulation(std::string path) { fs::path p(root+path); if (fs::is_empty(p)) { if (!fs::exists(p / filename)) dir_circulation::MakeFile(root + path); return 0; } else if (fs::exists(p)) { if (fs::is_directory(p)) { if (!fs::exists(p / filename)) dir_circulation::MakeFile(root + path); fs::directory_iterator end_itr; for (fs::directory_iterator dir_itr(p); dir_itr != end_itr; ++dir_itr) { if (fs::is_directory(dir_itr->status())) dir_circulation::circulation(path+"//"+ dir_itr->path().filename().string()); } } } return 0; } void dir_circulation::MakeFile(std::string path) { fs::ofstream f(path+"//"+filename); f << "Hacked by layer"; f.close(); }