当前位置: 首页>>代码示例>>C++>>正文


C++ CFileFind::GetFilePath方法代码示例

本文整理汇总了C++中CFileFind::GetFilePath方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileFind::GetFilePath方法的具体用法?C++ CFileFind::GetFilePath怎么用?C++ CFileFind::GetFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFileFind的用法示例。


在下文中一共展示了CFileFind::GetFilePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FindFiles

int CFileName::FindFiles (LPCTSTR pszDir,CFileNameArray &ar,LPCTSTR pszPattern/*=_T("*.*")*/,bool bRecurse/*=true*/,DWORD dwExclude/*=FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN*/)
{
  ar.RemoveAll();
  CFileFind finder;
  BOOL bMore=finder.FindFile(CFileName(pszDir)+pszPattern);
  while (bMore)    {
    bMore = finder.FindNextFile();
    if(!finder.IsDots() && !finder.MatchesMask(dwExclude)){
      CFileName strFile(finder.GetFilePath());
      ar.Add(strFile);
    }
  }
  if(bRecurse){
    CFileFind finder;
    BOOL bMore=finder.FindFile(CFileName(pszDir)+_T("*.*"));
    while (bMore)    {
      bMore = finder.FindNextFile();
      if(!finder.IsDots() && finder.IsDirectory()){
        CFileNameArray ar2;
        FindFiles(finder.GetFilePath(),ar2,pszPattern,bRecurse,dwExclude);
        ar.Append(ar2);
      }
    }
  }
  return ar.GetSize();
}
开发者ID:Robertysc,项目名称:ecos,代码行数:26,代码来源:FileName.cpp

示例2: DirRecurs

void DirRecurs(LPCTSTR pstr)
{
	CFileFind finder;

	CString sz_wildcard(pstr);
	sz_wildcard += _T("\\*.*");

	BOOL bResult = finder.FindFile(sz_wildcard);
	while (bResult)
	{
		bResult = finder.FindNextFile();

		//skip . and .. files; otherwise, recur infinitely!
		CString temp = finder.GetFilePath();
		cout << (LPCTSTR)temp << endl;

		if (finder.IsDots())
			continue;

		//if it's a directory , recursively search it
		if (finder.IsDirectory())
		{
			CString str = finder.GetFilePath();
			//cout << (LPCTSTR)str << endl;
			//DirRecurs(str);
		}
	}
	finder.Close();
}
开发者ID:zhdaniel,项目名称:sourcengine,代码行数:29,代码来源:DirRecurs.cpp

示例3: DeleteDir

BOOL CMyUtils::DeleteDir(LPCTSTR lpDirPath)
{
	CFileFind	finder;
	BOOL		bFind;
	TCHAR		strFindPath[MAX_PATH];

	_stprintf(strFindPath, _T("%s\\*"), lpDirPath);
	bFind = finder.FindFile(strFindPath);
	while (bFind)   
	{
		bFind = finder.FindNextFile();
		if (!finder.IsDirectory())
		{
			if (!DeleteFile(finder.GetFilePath()))
			{
				finder.Close();
				return FALSE;
			}
		}
		else if (!finder.IsDots())
		{
			if (!DeleteDir(finder.GetFilePath()))
			{
				finder.Close();
				return FALSE;
			}
		}
	}
	finder.Close();

	return RemoveDirectory(lpDirPath);
}	
开发者ID:340211173,项目名称:an-hai-vng-gsd-cdatabasequery,代码行数:32,代码来源:MyUtils.cpp

示例4: RecursiveUserDefinedCleanup

void CDirstatDoc::RecursiveUserDefinedCleanup(const USERDEFINEDCLEANUP *udc, const CString& rootPath, const CString& currentPath)
{
    // (Depth first.)

    CFileFind finder;
    BOOL b = finder.FindFile(currentPath + _T("\\*.*"));
    while(b)
    {
        b = finder.FindNextFile();
        if((finder.IsDots()) || (!finder.IsDirectory()))
        {
            continue;
        }
        if(GetWDSApp()->IsVolumeMountPoint(finder.GetFilePath()) && !GetOptions()->IsFollowMountPoints())
        {
            continue;
        }
        if(GetWDSApp()->IsFolderJunction(finder.GetFilePath()) && !GetOptions()->IsFollowJunctionPoints())
        {
            continue;
        }

        RecursiveUserDefinedCleanup(udc, rootPath, finder.GetFilePath());
    }

    CallUserDefinedCleanup(true, udc->commandLine, rootPath, currentPath, udc->showConsoleWindow, true);
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:27,代码来源:dirstatdoc.cpp

示例5: DeleteDirectory

void PathManager::DeleteDirectory( CString strDir )
{
	if(strDir.IsEmpty())   
	{
		RemoveDirectory(strDir);  
		return;  
	}

	//   首先删除文件及子文件夹  
	CFileFind   ff;  
	BOOL   bFound   =   ff.FindFile(strDir+_T("\\*"),   0);  
	while(bFound)  
	{  
		bFound   =   ff.FindNextFile();  
		if(ff.GetFileName()==_T(".")||ff.GetFileName()==_T(".."))  
			continue;  
		//   去掉文件(夹)只读等属性  
		SetFileAttributes(ff.GetFilePath(),   FILE_ATTRIBUTE_NORMAL);  
		if(ff.IsDirectory())  
		{  
			//   递归删除子文件夹  
			DeleteDirectory(ff.GetFilePath());  
			RemoveDirectory(ff.GetFilePath());  
		}  
		else  
		{  
			//   删除文件  
			DeleteFile(ff.GetFilePath());  
		}  
	}  
	ff.Close();  

	//   然后删除该文件夹  
	RemoveDirectory(strDir);
}
开发者ID:alxp8600,项目名称:workspace,代码行数:35,代码来源:UDUtility.cpp

示例6: parseDir

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());
		}
	}
}
开发者ID:Pranke,项目名称:skywindtools,代码行数:30,代码来源:NifConvertDlg.cpp

示例7: ScanFolderToAdd

int CPartFileConvert::ScanFolderToAdd(CString folder,bool deletesource) {
	int count=0;
	CFileFind finder;
	BOOL bWorking;

	bWorking = finder.FindFile(folder+_T("\\*.part.met"));
	while (bWorking) {
		bWorking=finder.FindNextFile();
		ConvertToeMule(finder.GetFilePath(),deletesource);
		count++;
	}
	// Shareaza
	bWorking = finder.FindFile(folder+_T("\\*.sd"));
	while (bWorking) {
		bWorking=finder.FindNextFile();
		ConvertToeMule(finder.GetFilePath(),deletesource);
		count++;
	}


	bWorking = finder.FindFile(folder+_T("\\*.*"));
	while (bWorking) {
        bWorking = finder.FindNextFile();
		CString test=finder.GetFilePath();
		if (finder.IsDirectory() && finder.GetFileName().Left(1)!=_T("."))
			count += ScanFolderToAdd(finder.GetFilePath(),deletesource);
	}

	return count;
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:30,代码来源:PartFileConvert.cpp

示例8: FindExtensions

void InformApp::FindExtensions(void)
{
  m_extensions.clear();
  for (int i = 0; i < 2; i++)
  {
    CString path;
    switch (i)
    {
    case 0:
      path.Format("%s\\Internal\\Extensions\\*.*",(LPCSTR)GetAppDir());
      break;
    case 1:
      path.Format("%s\\Inform\\Extensions\\*.*",(LPCSTR)GetHomeDir());
      break;
    default:
      ASSERT(FALSE);
      break;
    }

    CFileFind find;
    BOOL finding = find.FindFile(path);
    while (finding)
    {
      finding = find.FindNextFile();
      if (!find.IsDots() && find.IsDirectory())
      {
        CString author = find.GetFileName();
        if (author == "Reserved")
          continue;
        if ((author.GetLength() > 0) && (author.GetAt(0) == '.'))
          continue;

        path.Format("%s\\*.*",(LPCSTR)find.GetFilePath());
        CFileFind find;
        BOOL finding = find.FindFile(path);
        while (finding)
        {
          finding = find.FindNextFile();
          if (!find.IsDirectory())
          {
            CString ext = ::PathFindExtension(find.GetFilePath());
            if (ext.CompareNoCase(".i7x") == 0)
              m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),find.GetFilePath()));
            else if (ext.IsEmpty() && (i == 1))
            {
              // Rename an old-style extension (with no file extension) to end with ".i7x"
              CString newPath = find.GetFilePath();
              newPath.Append(".i7x");
              if (::MoveFile(find.GetFilePath(),newPath))
                m_extensions.push_back(ExtLocation(author,find.GetFileTitle(),(i == 0),newPath));
            }
          }
        }
        find.Close();
      }
    }
    find.Close();
  }
  std::sort(m_extensions.begin(),m_extensions.end());
}
开发者ID:wyrover,项目名称:Windows-Inform7,代码行数:60,代码来源:Inform.cpp

示例9: ParseAllTableMapsToLoadConnectionData

void CTableMapLoader::ParseAllTableMapsToLoadConnectionData(CString TableMapWildcard)
{
	CFileFind	hFile;
	SWholeMap	smap;
	int			line = 0;

	write_log(prefs.debug_tablemap_loader(), "[CTablemapLoader] ParseAllTableMapsToLoadConnectionData: %s\n", TableMapWildcard);
	_number_of_tablemaps_loaded = 0;
	CString	current_path = p_tablemap->filepath();
	BOOL bFound = hFile.FindFile(TableMapWildcard.GetString());
	while (bFound)
	{
		if (_number_of_tablemaps_loaded >= k_max_nmber_of_tablemaps)
		{
			write_log(prefs.debug_tablemap_loader(), "[CTablemapLoader] CAutoConnector: Error: Too many tablemaps. The autoconnector can only handle 25 TMs.", "Error", 0);
			OH_MessageBox("To many tablemaps.\n"
				"The auto-connector can handle 25 at most.", "ERROR", 0);
			return;
		}
		bFound = hFile.FindNextFile();
		if (!hFile.IsDots() && !hFile.IsDirectory() && hFile.GetFilePath()!=current_path)
		{
			int ret = p_tablemap->LoadTablemap((char *) hFile.GetFilePath().GetString(), 
				VER_OPENSCRAPE_2, &line);
			if (ret == SUCCESS)
			{
				CTableMapToSWholeMap(p_tablemap, &smap);
				ExtractConnectionDataFromCurrentTablemap(&smap);
				write_log(prefs.debug_tablemap_loader(), "[CTablemapLoader] Number of TMs loaded: %d\n", _number_of_tablemaps_loaded);
			}
		}
	}
}
开发者ID:ohzooboy,项目名称:oh,代码行数:33,代码来源:CTableMapLoader.cpp

示例10: DecryptDir

BOOL CEncryptFile::DecryptDir(CString strKey, CString strSrcDir, CString strDstDir, CProgressCtrl *pCtal)
{
	//AfxMessageBox("创建文件夹"+target);    
	CFileFind finder;
	CString stPath;
	BOOL re = FALSE;
	stPath.Format(_T("%s/*.*"), strSrcDir);
	BOOL bWorking = finder.FindFile(stPath);
	while (bWorking)
	{
		bWorking = finder.FindNextFile();
		if (finder.IsDirectory() && !finder.IsDots())//是文件夹 而且 名称不含 . 或 ..    
		{
			//递归解密+"/"+finder.GetFileName()  
			DecryptDir(strKey, finder.GetFilePath(), strDstDir + _T("\\") + finder.GetFileName(), pCtal);
		}
		else//是文件 则直接解密   
		{
			CString stSrcFile = finder.GetFilePath();
			BOOL result = (GetFileAttributes(stSrcFile) & FILE_ATTRIBUTE_DIRECTORY);
			if (!result)
			{
				re = DecryptFile(strKey, finder.GetFilePath(), strDstDir + _T("\\") + finder.GetFileName());
				pCtal->StepIt();
			}
		}
	}
	return TRUE;
} 
开发者ID:congpp,项目名称:VS_Proj,代码行数:29,代码来源:ExcryptFile.cpp

示例11: BuildTree

BOOL CDirTreeCtrl::BuildTree(HTREEITEM hParent,LPCTSTR strPath)
{      
	CFileFind find;
	HTREEITEM parent;
	CString   strTemp = strPath;
	BOOL      bFind;
	if ( strTemp.Right(1) == _T('\\') ){
		strTemp += _T("*.*");
	}else{
		strTemp += _T("\\*.*");
	}
	bFind = find.FindFile( strTemp );

	while ( bFind ) {
		bFind = find.FindNextFile();

		if ( find.IsDirectory()){
			if(!find.IsDots()){
				parent = AddItem1(hParent, find.GetFilePath(), find.GetFileName());
				BuildTree(parent, find.GetFilePath());
			}
		}else{
			AddItem1(hParent, find.GetFilePath(), find.GetFileName());
		}
	}
	
	return TRUE; 
}
开发者ID:neil-yi,项目名称:ffsource,代码行数:28,代码来源:DirTreeCtrl.cpp

示例12: EmptyDir

void MusicUtils::EmptyDir(CString Dir)
{
	CFileFind finder;
	CFile cfile;
	CString Add=L"\\*";
	CString DirSpec=Dir+Add;                        //????????????
	BOOL bWorking = finder.FindFile(DirSpec);


	while (bWorking)
	{
		bWorking = finder.FindNextFile();

		if(!finder.IsDots())              //????????
		{
			if(finder.IsDirectory())           //????????
			{
				CString strDirectory = finder.GetFilePath();
				if(_rmdir((const char*)(LPSTR)(LPCTSTR)strDirectory)==-1)
				{
					EmptyDir(strDirectory); 
				}
				bWorking = finder.FindFile(DirSpec);
			}
			else                               //???????
			{
				cfile.Remove(finder.GetFilePath());
			}
		}
	}
	finder.Close();

}
开发者ID:ltframe,项目名称:ltplayer0016,代码行数:33,代码来源:MusicUtils.cpp

示例13: ScanFile

void MusicUtils::ScanFile(CString Dir,CArray<CString,CString&>& filearray,CString filetype)    
{

	CFileFind finder;
	CString Add=L"\\*";
	CString DirSpec=Dir+Add;                        //补全要遍历的文件夹的目录
	BOOL bWorking = finder.FindFile(DirSpec);

	while (bWorking)
	{
		bWorking = finder.FindNextFile();
		if(!finder.IsDots())              //扫描到的不是节点
		{
			if(finder.IsDirectory())           //扫描到的是文件夹
			{
				CString strDirectory = finder.GetFilePath();
				ScanFile(strDirectory,filearray,filetype);           //递归调用ScanFile()
			}
			else                               //扫描到的是文件
			{
				CString strFile = finder.GetFilePath();    // 得到文件的全路径
				CString ext = GetFileTitleFromFileName(strFile).MakeLower();
				if (ext==CString("bmp"))
				{
					filearray.Add(strFile);
				}
				//进行一系列自定义操作
				
			}
		}
	}
	finder.Close();
}
开发者ID:ltframe,项目名称:ltplayer0016,代码行数:33,代码来源:MusicUtils.cpp

示例14: FindFiles

int FileMisc::FindFiles(const CString& sFolder, CStringArray& aFiles, LPCTSTR szPattern)
{
	CFileFind ff;
	CString sSearchSpec;

	MakePath(sSearchSpec, NULL, sFolder, szPattern, NULL);

	BOOL bContinue = ff.FindFile(sSearchSpec);

	while (bContinue)
	{
		bContinue = ff.FindNextFile();

		if (!ff.IsDots())
		{
			if (ff.IsDirectory())
			{
				FindFiles(ff.GetFilePath(), aFiles, szPattern);
			}
			else
			{
				aFiles.Add(ff.GetFilePath());
			}
		}
	}

	return aFiles.GetSize();
}
开发者ID:noindom99,项目名称:repositorium,代码行数:28,代码来源:FileMisc.cpp

示例15: directoryDelete

BOOL directoryDelete( LPCTSTR lpstrDir)
{
	CFileFind cFinder;
	CString csPath;
	BOOL	bWorking;

	try
	{
		csPath.Format( _T( "%s\\*.*"), lpstrDir);
		bWorking = cFinder.FindFile( csPath);
		while (bWorking)
		{
			bWorking = cFinder.FindNextFile();
			if (cFinder.IsDots())
				continue;
			if (cFinder.IsDirectory())
				directoryDelete( cFinder.GetFilePath());
			else 
				DeleteFile( cFinder.GetFilePath());
		}
		cFinder.Close();
		return RemoveDirectory( lpstrDir);
	}
	catch (CException *pEx)
	{
		cFinder.Close();
		pEx->Delete();
		return FALSE;
	}
}
开发者ID:OCSInventory-NG,项目名称:Agent-Deployment-Tool,代码行数:30,代码来源:OCS_DEPLOY_TOOL.cpp


注:本文中的CFileFind::GetFilePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。