コード例 #1
0
ファイル: PathHelper.cpp プロジェクト: pyq881120/urltraveler
BOOL PathHelper::GetAllFile(
    const std::wstring & strDir,
    CStdStringVector &vecFile,
    const std::wstring &strDirMask,
    const std::wstring &strFileMask
)
{
    BOOL bResult = FALSE;
    vecFile.clear();

    CStdStringVector vecSubDir;

    ///获取所有子目录
    bResult = GetAllSubDir(strDir, vecSubDir, strDirMask);

    ///将目录自己也压入进去以查找文件
    vecSubDir.push_back(strDir);

    if (vecSubDir.size() > 0)
    {
        CStdStringVector::iterator iter = vecSubDir.begin();
        while (iter != vecSubDir.end())
        {
            CStdStringVector vecTmpFile;
            GetDirFile(*iter, vecTmpFile, strFileMask);

            vecFile.insert(vecFile.end(), vecTmpFile.begin(), vecTmpFile.end());

            iter ++;
        }
    }

    bResult = (vecFile.size() > 0) ;
    return bResult;
}
コード例 #2
0
ファイル: main.cpp プロジェクト: CallumCVM/FrostbiteGen
/// <summary>
/// DLLs the main.
/// </summary>
/// <param name="hinstDLL">The hinst DLL.</param>
/// <param name="fdwReason">The FDW reason.</param>
/// <param name="lpvReserved">The LPV reserved.</param>
/// <returns></returns>
BOOL WINAPI DllMain(
	_In_ HINSTANCE hinstDLL,
	_In_ DWORD     fdwReason,
	_In_ LPVOID    lpvReserved
	)
{
	
	if (fdwReason == DLL_PROCESS_ATTACH)
	{
		if (GetModuleFileNameA(hinstDLL, g_szBaseDir, sizeof(g_szBaseDir)))
		{
			for (int i = (int)strlen(g_szBaseDir); i > 0; i--)
			{
				if (g_szBaseDir[i] == '\\')
				{
					g_szBaseDir[i + 1] = 0;

					break;
				}
			}
		}
		sprintf(g_szLogFile, "%sfbgen.txt", g_szBaseDir);

		std::ofstream fout;
		fout.open(g_szLogFile, std::ios::trunc);
		fout.close();

		char sdkPath[MAX_PATH];

		GetDirFile("SDK\\", sdkPath, sizeof(sdkPath));
		DWORD dwAttr = GetFileAttributes(sdkPath);
		if (dwAttr == INVALID_FILE_ATTRIBUTES)
			CreateDirectory(sdkPath, NULL);

#if 0
		// todo: sort into different directories?
		// you will have to resolve the include paths correctly though depending on what type they are
		GetDirFile("SDK\\classes\\", sdkPath, sizeof(sdkPath));
		dwAttr = GetFileAttributes(sdkPath);
		if (dwAttr == INVALID_FILE_ATTRIBUTES)
			CreateDirectory(sdkPath, NULL);

		GetDirFile("SDK\\enums\\", sdkPath, sizeof(sdkPath));
		dwAttr = GetFileAttributes(sdkPath);
		if (dwAttr == INVALID_FILE_ATTRIBUTES)
			CreateDirectory(sdkPath, NULL);
#endif

		ClassInfo* classInfo = ClassInfo::GetInstance();
		if (!classInfo)
			return FALSE;

		ClassInfoManager manager(classInfo);
		manager.BuildClassList();
		manager.DumpClasses();

		MessageBox(0, "success", 0, 0);
	}

	return 0;
}