|
|
@ -8,8 +8,11 @@ |
|
|
|
#include <string> |
|
|
|
#include <map> |
|
|
|
#include <iomanip> |
|
|
|
// #include <sys/io.h>
|
|
|
|
#include <dirent.h> |
|
|
|
#ifdef _WIN32 |
|
|
|
#include <io.h> |
|
|
|
#else |
|
|
|
#include <dirent.h> |
|
|
|
#endif |
|
|
|
#include <vector> |
|
|
|
#include <fstream> |
|
|
|
#include <sstream> |
|
|
@ -250,36 +253,37 @@ void produceXML(const char *xml, const char *connectorFile, string resultfile) |
|
|
|
branchTree.init(); |
|
|
|
} |
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
// VSMC io.h 支持下使用
|
|
|
|
// void getAllFiles(string path, vector<string> &files)
|
|
|
|
// {
|
|
|
|
// // 文件句柄
|
|
|
|
// long long hFile = 0;
|
|
|
|
// // 文件信息
|
|
|
|
// struct _finddata_t fileinfo;
|
|
|
|
// string p;
|
|
|
|
// if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1)
|
|
|
|
// {
|
|
|
|
// do
|
|
|
|
// {
|
|
|
|
// if ((fileinfo.attrib & _A_SUBDIR))
|
|
|
|
// { // 比较文件类型是否是文件夹
|
|
|
|
// if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
|
|
|
|
// {
|
|
|
|
// files.push_back(p.assign(path).append("\\").append(fileinfo.name));
|
|
|
|
// // 递归搜索
|
|
|
|
// getAllFiles(p.assign(path).append("\\").append(fileinfo.name), files);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// files.push_back(p.assign(path).append("\\").append(fileinfo.name));
|
|
|
|
// }
|
|
|
|
// } while (_findnext(hFile, &fileinfo) == 0); // 寻找下一个,成功返回0,否则-1
|
|
|
|
// _findclose(hFile);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
void getAllFiles(string path, vector<string> &files) |
|
|
|
{ |
|
|
|
// 文件句柄
|
|
|
|
long long hFile = 0; |
|
|
|
// 文件信息
|
|
|
|
struct _finddata_t fileinfo; |
|
|
|
string p; |
|
|
|
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) |
|
|
|
{ |
|
|
|
do |
|
|
|
{ |
|
|
|
if ((fileinfo.attrib & _A_SUBDIR)) |
|
|
|
{ // 比较文件类型是否是文件夹
|
|
|
|
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) |
|
|
|
{ |
|
|
|
files.push_back(p.assign(path).append("\\").append(fileinfo.name)); |
|
|
|
// 递归搜索
|
|
|
|
getAllFiles(p.assign(path).append("\\").append(fileinfo.name), files); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
files.push_back(p.assign(path).append("\\").append(fileinfo.name)); |
|
|
|
} |
|
|
|
} while (_findnext(hFile, &fileinfo) == 0); // 寻找下一个,成功返回0,否则-1
|
|
|
|
_findclose(hFile); |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
void getAllFiles(string path, vector<string> &files) |
|
|
|
{ |
|
|
|
|
|
|
@ -294,10 +298,11 @@ void getAllFiles(string path, vector<string> &files) |
|
|
|
continue; |
|
|
|
files.push_back(std::__fs::filesystem::path(path).append(dirp->d_name)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
closedir(dp); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化各个结构体
|
|
|
|