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


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

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


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

示例1: 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

示例2: 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

示例3: rmDir

BOOL FileUtils::rmDir(string dirName)
{
	char sTempFileFind[MAX_PATH] = "";
	sprintf_s(sTempFileFind, "%s\\*.*", dirName.c_str());
	
	CFileFind tempFind;
	BOOL isFinded = tempFind.FindFile(sTempFileFind);
	while (isFinded) {
		isFinded = tempFind.FindNextFile();
		/*
		 * 跳过 每个文件夹下面都有的两个特殊子文件夹:
		 *	(1) .  表示本文件夹自己
		 *	(2) .. 表示本文件夹的父文件夹
		 */
		if (!tempFind.IsDots()) {
			char tempFileOrDir[MAX_PATH] = "";
			sprintf_s(tempFileOrDir, "%s\\%s", dirName.c_str(), tempFind.GetFileName().GetBuffer(MAX_PATH));

			if (tempFind.IsReadOnly()) ::SetFileAttributes(tempFileOrDir, FILE_ATTRIBUTE_NORMAL);
			
			if (tempFind.IsDirectory()) rmDir(tempFileOrDir);
			else ::DeleteFile(tempFileOrDir);
		}
	}
	tempFind.Close();

	return ::RemoveDirectory(dirName.c_str());
}
开发者ID:yanglianxiang,项目名称:intern,代码行数:28,代码来源:FileUtils.cpp

示例4: GetSkinList

void CSkinManager::GetSkinList(CStringArray &skins)
{
	CFileFind finder;
	CString dir = CMyUtility::GetCurDir();
	CString strSkins;
	strSkins.Format(_T("%s\\skins\\*.*"), dir);

	BOOL bFind = finder.FindFile(strSkins);
	if(!bFind)
		return;

	while(bFind)
	{
		bFind = finder.FindNextFile();
		if(finder.IsDots())
			continue;

		if(finder.IsDirectory())
		{
			skins.Add(finder.GetFileName());
			continue;
		}
	}

	finder.Close();

}
开发者ID:harrysun2006,项目名称:ag_Client,代码行数:27,代码来源:SkinManager.cpp

示例5: AddFilesFromPath

bool CTestList::AddFilesFromPath( LPCTSTR pcszPath, HTREEITEM htreeParent )
{
	CString strPath( pcszPath );
	strPath += _T("\\*.*");

	CFileFind finder;
	BOOL bFound = finder.FindFile( strPath );
	while( bFound )
	{
		bFound = finder.FindNextFile();
		if( !finder.IsDots() )
		{

			CString strName( finder.GetFileName() );
			if( strName.Find( _T(".html") ) != -1 || finder.IsDirectory() )
			{
				TVITEM tvi; 
				TVINSERTSTRUCT tvins; 

				tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; 
				UINT uItem = m_arrFile.GetSize();
				const CString strFilePath( finder.GetFilePath() );
				m_arrFile.Add( strFilePath );

				// Set the text of the item. 
				tvi.pszText = (LPTSTR)(LPCTSTR)strName; 
				tvi.cchTextMax = strName.GetLength(); 

				tvi.iImage = tvi.iSelectedImage = 0;

				tvi.lParam = (LPARAM) uItem; 

				tvins.item = tvi; 
				tvins.hInsertAfter = TVI_LAST;

				tvins.hParent = htreeParent;

				//
				// Add the item to the tree-view control. 
				HTREEITEM hTree = (HTREEITEM)m_treeList.SendMessage( TVM_INSERTITEM, 0, (LPARAM) (LPTVINSERTSTRUCT) &tvins);
				
				if( strFilePath == m_strLastLoaded )
				{
					PostMessage( WM_MY_FIRST_SELECT, (WPARAM)hTree, 0 );
				}

				if( finder.IsDirectory() )
				{
					CString strPath( pcszPath );
					strPath += _T("\\");
					strPath += finder.GetFileName();
					AddFilesFromPath( strPath, hTree );
				}

			}

		}
	}
	return false;
}
开发者ID:F5000,项目名称:spree,代码行数:60,代码来源:testlist.cpp

示例6: freshSphLib

void CTestPage::freshSphLib()
{
	DataBase db;
	BOOL bTraining = FALSE;
	db.ResetTable(_T("SpeechLib"),bTraining);

	//CStringArray* idArray = db.GetAllUserInfo(_T("UserId"));

	CString SpeechDir = _T("F:\\SpeechDirectory");
	CString UserId,WavName,SphPath;
	CFileFind finder;
	
	UserId = _T("Test");
	SphPath = SpeechDir + _T("\\") + UserId + _T("\\") + _T("*.wav");
	BOOL res = finder.FindFile(SphPath);
	while(res){
		res = finder.FindNextFile();
		if(finder.IsDots()||finder.IsDirectory())  
			continue;
		WavName = finder.GetFileName();
		db.InsertSpeechLib(UserId,WavName);		
	}
	
	finder.Close();
	
}
开发者ID:jltong,项目名称:GraduateWorks,代码行数:26,代码来源:TestPage.cpp

示例7: RecursiveRemoveFolder

//////////////////////////////////////////////////////////////////////////
//递归删除文件夹
//////////////////////////////////////////////////////////////////////////
BOOL RecursiveRemoveFolder(CString strFolderPath,BOOL bRecursive)
{
	CFileFind finder;
	CString strPath;
	BOOL bFound;

	if (strFolderPath.ReverseFind('\\') != 0)
		strFolderPath.Append(L"\\*.*");
	
	bFound = finder.FindFile(strFolderPath);

	while(bFound)
	{
		bFound = finder.FindNextFile();
		strPath = finder.GetFilePath();

		if (finder.IsDots())
			continue;
		else if (finder.IsDirectory() && bRecursive)
			RecursiveRemoveFolder(strPath,bRecursive);
		else
		{
			::SetFileAttributes(strPath,FILE_ATTRIBUTE_NORMAL);
			::DeleteFile(strPath);
		}
	}

	finder.Close();
	return ::RemoveDirectory(strFolderPath);
}
开发者ID:colordancer,项目名称:GenOpr,代码行数:33,代码来源:gerneralopr.cpp

示例8: RestoreFile

void CUpdateMgr::RestoreFile(wstring strRestorePath,wstring wsCurDirectory)
{
	CFileFind fileFinder;
	CString filePath ;//= strRestorePath.c_str() + _T("//*.*");
	filePath.Format(_T("%s\\*.*"),strRestorePath.c_str());
	BOOL bFinished = fileFinder.FindFile(filePath);
	wstring wsDestfile;
	wstring wsRestoreFile;
	while(bFinished)  //每次循环对应一个类别目录
	{
		bFinished = fileFinder.FindNextFile();
		if(fileFinder.IsDirectory() && !fileFinder.IsDots())  //若是目录则递归调用此方法
		{
			// BayesCategoryTest(bt, fileFinder.GetFilePath());
		}
		else  //再判断是否为txt文件
		{
			//获取文件类型
			CString fileName = fileFinder.GetFileName();
			if(fileName.Right(4).CompareNoCase(_T("_BAK")) == 0)
			{
				wsRestoreFile = strRestorePath + L"\\" + fileName.GetBuffer(0);
				wsDestfile = wsCurDirectory + L"\\" + fileName.Left(fileName.GetLength()-4).GetBuffer(0);
				BOOL bret = CsysFile::Copy(wsRestoreFile,wsDestfile);
				if (FALSE == bret)
				{
					g_Logger.Error(__FILE__,__LINE__,"还原文件失败 restore %s to %s",ws2s(wsRestoreFile).c_str(),ws2s(wsDestfile).c_str());
				}
			}
		}
	}
}
开发者ID:charlessoft,项目名称:updateproject,代码行数:32,代码来源:UpdateMgr.cpp

示例9: 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

示例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: SMT_GetAllFileName

/*=================================================================
* Function ID :  SMT_GetAllFileName
* Input       :  void
* Output      :  void
* Author      :  
* Date        :  2006  2
* Return	  :  void
* Description :  得到所有文件名
* Notice	  :  
*=================================================================*/
void CSmartCommunicationDlg::SMT_GetAllFileName(vector<CString>& VFileName)
{
	CString   szDir=m_DealPath;
	CString	  strFile;	
	CFileFind ff;

	if(szDir.Right(1)!= "\\")
	{
		szDir+="\\";
	}
	szDir+= "*.*";
	BOOL res=ff.FindFile(szDir);   
	while(res)
	{
		res=ff.FindNextFile();
		strFile=ff.GetFileName();
		if(ff.IsDirectory() &&!ff.IsDots())   
		{   
			continue;
		}   
		if( strFile=="." || strFile=="..")
		{
			continue;
		}
		VFileName.push_back(strFile);
	}
	ff.Close();
	return ;
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:39,代码来源:SmartCommunicationDlg.cpp

示例12: DeletePath

void Utils::DeletePath(CString sPath)
{
	CFileFind tempFind;    
	bool IsFinded = tempFind.FindFile(sPath + "\\*.*");    
	while (IsFinded)    
	{    
		IsFinded = tempFind.FindNextFile();    
		//当这个目录中不含有.的时候,就是说这不是一个文件。  
		if (!tempFind.IsDots())    
		{    
			char sFoundFileName[200];     
			strcpy(sFoundFileName,tempFind.GetFileName().GetBuffer(200));  
			//如果是目录那么删除目录  
			if (tempFind.IsDirectory())    
			{     
				char sTempDir[200];       
				sprintf(sTempDir,"%s\\%s",sPath,sFoundFileName);    
				DeletePath(sTempDir); //其实真正删除文件的也就这两句,别的都是陪衬  
			}    
			//如果是文件那么删除文件  
			else      
			{     
				char sTempFileName[200];      
				sprintf(sTempFileName,"%s\\%s",sPath,sFoundFileName);    
				DeleteFile(sTempFileName);    
			}    
		}    
	}    
	tempFind.Close();
	RemoveDirectory(sPath);
}
开发者ID:TonySongling,项目名称:StaffManager,代码行数:31,代码来源:Utils.cpp

示例13: CheckCleanupFileLogFile

//日志文件清理
void CWriteLogThread::CheckCleanupFileLogFile()
{
    if(m_nLogFileCleanupDate == 0)
    {
        return;
    }

     COleDateTime time1,time2;
     COleDateTimeSpan time3;
     time2 = COleDateTime::GetCurrentTime();
     int nYear,nMonth,nDate;
     
     sscanf(m_strLastCleanupLogFileDate, "%d:%d:%d",&nYear,&nMonth,&nDate);
     time1.SetDate(nYear,nMonth,nDate);
 
     time3 = time2 - time1;
     int nRunData = time3.GetDays();

    //程序连续运行m_nLogFileCleanupDate天进行一次日志文件清理,保存前一天的日志
    //m_nLogFileCleanupDate可以调用SetLogFileCleanupDate()函数设置
    if(nRunData >= m_nLogFileCleanupDate) //
    {
        m_strLastCleanupLogFileDate = CTime::GetCurrentTime().Format("%Y:%m:%d");

        CFileFind tempFileFind;
	    CString szDir = m_strAppLogDir;
	    CString strTitle;
	    CFile file;

	    if(szDir.Right(1) != _T("\\"))
        {
		    szDir += _T("\\");
        }
	    szDir += _T("*.txt");

	    BOOL res = tempFileFind.FindFile(szDir);

        CString strYesterdayLogName;

        CTime time =CTime::GetCurrentTime() - CTimeSpan(1,0, 0,0);
        strYesterdayLogName = time.Format("%Y%m%d"); //前一天的日期
        CString strDeleteFilePath;
	    while( res )
	    {
		    res = tempFileFind.FindNextFile();
		    if(!tempFileFind.IsDirectory() && !tempFileFind.IsDots())
		    {
			    strTitle = tempFileFind.GetFileName();
                if(strTitle.Find(strYesterdayLogName) == -1) //只保留前一天的日志文件
                {
                    //删除txt文件
                    strDeleteFilePath.Format("%s\\%s",m_strAppLogDir,strTitle);
                    CFile::Remove(strDeleteFilePath);//删除文件
                }
			    
		    }
	    }
	    tempFileFind.Close();
    }
}
开发者ID:lubing521,项目名称:Hitown,代码行数:61,代码来源:WriteLogThread.cpp

示例14: 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

示例15: 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


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