获取附加依赖项
作者:
小小蒟蒻
,
2022-07-21 10:38:20
,
所有人可见
,
阅读 191
#include <io.h>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
#pragma region
vector<string>batchFetchingLib(string& folder_path)
{
string filename_suffix = "/*lib";
vector<string>files;
struct _finddata_t fileinfo;
intptr_t handle;
handle = _findfirst((folder_path + filename_suffix).data(), &fileinfo);
if (handle == -1)
{
printf("输入的路径有错误");
exit(-1);
}
else
{
files.push_back(fileinfo.name);
while (_findnext(handle, &fileinfo) == 0)
{
if (strcmp(fileinfo.name, ".") == 0 || strcmp(fileinfo.name, "..") == 0)
continue;
files.push_back(fileinfo.name);
}
}
_findclose(handle);
return files;
}
#pragma endregion
int main()
{
string pcl_lib_path("D://PCL 1.11.1//lib");
string vtk_lib_path("D://PCL 1.11.1//3rdParty//VTK//lib");
vector<string>PCL = batchFetchingLib(pcl_lib_path);
vector<string>VTK = batchFetchingLib(vtk_lib_path);
ofstream release, debug;
release.open("PCL1.11.1_Release附加依赖项.txt", ios::app);
debug.open("PCL1.11.1_Debug附加依赖项.txt", ios::app);
for (size_t i = 0; i < PCL.size(); ++i)
{
(i % 2 == 0) ? release << PCL[i] << endl : debug << PCL[i] << endl;
}
for (size_t i = 0; i < VTK.size(); ++i)
{
(i % 2 != 0) ? release << VTK[i] << endl : debug << VTK[i] << endl;
}
release.close();
debug.close();
cout << "附加依赖项获取完毕!!!" << endl;
return 0;
}