MCPcopy Create free account
hub / github.com/Italink/ModernGraphicsEngineGuide / traverse

Function traverse

Docs/MkdocsRepair/main.cpp:61–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void traverse(directory_iterator trans, string str = " ") {
62 while (!trans._At_end()) {
63 directory_iterator it = trans;
64 if ((*it).is_directory()) {
65 try { //���ܷ��ʵ�ϵͳ�ļ�����Ȩ�޲���������������Ҫ�����쳣����
66 printf("%s \n", it->path().string().c_str());
67 traverse(directory_iterator((*it).path()), str + (trans._At_end() ? " " : "�� "));
68 }
69 catch (filesystem_error s) {
70 continue;
71 }
72 }
73 else if(it->is_regular_file()) {
74 const string& ext = it->path().extension().string();
75 if (ext == ".md"|| ext == ".MD"|| ext == ".mD" || ext == ".Md") {
76 printf("%s \n",it->path().string().c_str());
77 std::ifstream fin(it->path());
78 std::stringstream buffer;
79 buffer << fin.rdbuf();
80 const std::string& str = buffer.str();
81 fin.close();
82 const string& result = repair(str);
83 std::ofstream fout(it->path());
84 fout<<result;
85 fout.close();
86 }
87 }
88 trans++;
89 }
90}
91
92int main() {
93 traverse(directory_iterator("./"));

Callers 1

mainFunction · 0.85

Calls 1

repairFunction · 0.85

Tested by

no test coverage detected