Esempio n. 1
0
void CNifConvertDlg::parseDir(CString path, set<string>& directories, bool doDirs)
{
	CFileFind   finder;
	BOOL        result(FALSE);

	result = finder.FindFile(path + _T("\\*.*"));

	while (result)
	{
		result = finder.FindNextFileW();

		if (finder.IsDots())    continue;
		if (finder.IsDirectory() && doDirs)
		{
			CString   newDir(finder.GetFilePath());
			CString   tDir = newDir.Right(newDir.GetLength() - newDir.Find(_T("\\Textures\\")) - 1);

			directories.insert(CStringA(tDir).GetString());

			parseDir(newDir, directories);
		}
		else if (!finder.IsDirectory() && !doDirs)
		{
			CString   newDir(finder.GetFilePath());
			CString   tDir = newDir.Right(newDir.GetLength() - path.GetLength() - 1);

			directories.insert(CStringA(tDir).GetString());
		}
	}
}
Esempio n. 2
0
int CDirectoryUtil::FindFiles(const wchar_t* directory)
{
	m_files.RemoveAll();
	CFileFind fileFinder;
	CString filePath(directory);
	if(L'\\' != directory[wcslen(directory) - 1])
	{
		filePath += L"\\";
	}
	filePath += "*.*";
	BOOL hasFile = fileFinder.FindFile(filePath);

	while(hasFile)
	{
		hasFile = fileFinder.FindNextFileW();
		if(!fileFinder.IsDirectory() && !fileFinder.IsDots())
		{
			m_files.AddTail(fileFinder.GetFilePath());
		}
	}

	return m_files.GetCount();
}