Browse Source

MacOS迁移

divide_struct_def_imp
郑敬润 10 months ago
parent
commit
0ff84ecff6
  1. 69
      src/xmlsql.cpp

69
src/xmlsql.cpp

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

Loading…
Cancel
Save