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


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

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


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

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

示例2: GetDirectoryContain

void YpDirectory::GetDirectoryContain(vector<CString>& list)
{
	CFileFind ff;
	CString szDir = path;

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

	szDir += "*.*";

	BOOL res = ff.FindFile(szDir);
	const CString each = "{%s|%d|%s}";
	while(res)
	{
		res = ff.FindNextFile();
		CString temp;
		if (ff.IsDirectory() && !ff.IsDots())
		{
			temp.Format(each, ff.GetFileName(), 0, "Ŀ¼");
			list.push_back(temp);
		}
		else if(!ff.IsDirectory() && !ff.IsDots())
		{
			CFileStatus status;
			CString path = ff.GetFilePath();
			CFile::GetStatus(path, status);
			temp.Format(each, ff.GetFileName(), (UINT)(status.m_size / 1024.0), ff.GetFileTitle());
			list.push_back(temp);
		}
	}
	ff.Close();
}
开发者ID:ypcmos,项目名称:PhantomServer,代码行数:34,代码来源:FileSystem.cpp

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

示例4: FindSubDir

BOOL CDirTreeCtrl::FindSubDir( LPCTSTR strPath)
{
	//
	// Are there subDirs ?
	//
	CFileFind find;
	CString   strTemp = strPath;
	BOOL      bFind;

	if ( strTemp[strTemp.GetLength()-1] == '\\' )
		strTemp += _T("*.*");
	else
		strTemp += _T("\\*.*");
		
	bFind = find.FindFile( strTemp );
	
	
	while ( bFind )
	{
		bFind = find.FindNextFile();

		if ( find.IsDirectory() && !find.IsDots() )
		{
			return TRUE;
		}
		if ( !find.IsDirectory() && m_bFiles && !find.IsHidden() )
			return TRUE;
		
	}

	return FALSE;

}
开发者ID:AutoCAD-DCI,项目名称:CADTools,代码行数:33,代码来源:DirTreeCtrl.cpp

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

示例6: ItemHasChildren

BOOL CDirTreeCtrl::AddSubDirAsItem1(HTREEITEM hParent)
{
	CString strPath,strFileName;
	HTREEITEM hChild;
	//---------------------去除该父项下所有的子项------------   // 因为有dummy项,并且有时子目录再次打开,或子目录会刷新等,因此必须去除。
	while ( ItemHasChildren(hParent))  {
		hChild = GetChildItem(hParent);
		DeleteItem( hChild );
	}    //-----------------------装入该父项下所有子项--------------  
	strPath = GetFullPath(hParent);

	CString strSearchCmd = strPath;
	if( strSearchCmd.Right( 1 ) != _T( "\\" ))
		strSearchCmd += _T( "\\" );

	strSearchCmd += _T( "*.*" );
	CFileFind find;
	BOOL bContinue = find.FindFile( strSearchCmd );
	while ( bContinue )  {
		bContinue = find.FindNextFile();
		strFileName = find.GetFileName();

		 if(!find.IsHidden() && ! find.IsDots() && find.IsDirectory() )
		 {
			 hChild = AddItem( hParent, strFileName );
		 }

		if ( !find.IsHidden() && ! find.IsDots() && !find.IsDirectory() )   {
			InsertItem( strFileName, 0, 0, hParent );
		}
    }

    return TRUE; 
}
开发者ID:neil-yi,项目名称:ffsource,代码行数:34,代码来源:DirTreeCtrl.cpp

示例7: DisplayPath

void CDirTreeCtrl::DisplayPath(HTREEITEM hParent, LPCTSTR strPath)
{
	//
	// Displaying the Path in the TreeCtrl
	//
	CFileFind find;
	CString   strPathFiles = strPath;
	BOOL      bFind;
	CSortStringArray strDirArray;
	CSortStringArray strFileArray;
	
	if ( strPathFiles.Right(1) != _T("\\") )
		strPathFiles += _T("\\");
	strPathFiles += _T("*.*");

	bFind = find.FindFile( strPathFiles );

	while ( bFind )
	{
		bFind = find.FindNextFile();
		if ( find.IsDirectory() && !find.IsDots() )
		{		
			strDirArray.Add( find.GetFilePath() );
		}
		if ( !find.IsDirectory() && m_bFiles )
			strFileArray.Add( find.GetFilePath() );

	}
    
	strDirArray.Sort();
	SetRedraw( FALSE );
	CWaitCursor wait;
    
	for ( int i = 0; i < strDirArray.GetSize(); i++ )
	{
			HTREEITEM hItem = AddItem( hParent, strDirArray.GetAt(i) );
			if ( FindSubDir( strDirArray.GetAt(i) ) )
				InsertItem( _T(""), 0, 0, hItem );
	}

	if ( m_bFiles )
	{
		strFileArray.Sort();
		for (int i = 0; i < strFileArray.GetSize(); i++ )
		{
			HTREEITEM hItem = AddItem( hParent, strFileArray.GetAt(i) );
			
		}
	}
    
	SetRedraw( TRUE );

	
}
开发者ID:AutoCAD-DCI,项目名称:CADTools,代码行数:54,代码来源:DirTreeCtrl.cpp

示例8: staticPathList

static void staticPathList(std::list<CString>& paths, std::set<CString>& folders, const CString& startDir, const CString& folder, BOOL recursive)
{
	CString strDirectory = PathJoin(startDir, folder);

	CFileFind finder;	
	BOOL bWorking = finder.FindFile(strDirectory + _T("\\*.*"));
	while (bWorking)
	{
		bWorking = finder.FindNextFile();

		CString filename = finder.GetFileName();

		if (filename == "." || filename == "..")
			continue;

		if (finder.IsDirectory())
		{
			if (recursive)
			{
				staticPathList(paths, folders, startDir, PathJoin(folder, filename), recursive);
			}
			folders.insert(PathJoin(folder, filename));
		}
		else
		{
			paths.push_back(PathJoin(folder, filename));
		}
	}
}
开发者ID:ror13,项目名称:diplom,代码行数:29,代码来源:FileHelpers.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: DeleteDirectory

BOOL FileMgr::DeleteDirectory(LPCTSTR Directory)
{
	CFileFind tempFind;
	TCHAR sTempFileFind[MAX_PATH] = { 0 };
	_stprintf_s(sTempFileFind,MAX_PATH, _T("%s//*.*"), Directory);
	BOOL IsFinded = tempFind.FindFile(sTempFileFind);
	while (IsFinded)
	{
		IsFinded = tempFind.FindNextFile();
		if (!tempFind.IsDots())
		{
			TCHAR sFoundFileName[MAX_PATH] = { 0 };
			_tcscpy_s(sFoundFileName, MAX_PATH, tempFind.GetFileName().GetBuffer(200));
			if (tempFind.IsDirectory())
			{
				TCHAR sTempDir[MAX_PATH] = { 0 };
				_stprintf_s(sTempDir, MAX_PATH, _T("%s//%s"), Directory, sFoundFileName);
				DeleteDirectory(sTempDir);
			}
			else
			{
				TCHAR sTempFileName[MAX_PATH] = { 0 };
				_stprintf_s(sTempFileName, MAX_PATH, _T("%s//%s"), Directory, sFoundFileName);
				DeleteFile(sTempFileName);
			}
		}
	}
	tempFind.Close();
	if (!RemoveDirectory(Directory))
	{
		return FALSE;
	}
	return TRUE;
}
开发者ID:tantaishan,项目名称:MyEcho,代码行数:34,代码来源:FileMgr.cpp

示例11: DeleteDirectory

bool DeleteDirectory(const char *DirName)//如删除DeleteDirectory("c:\\aaa") 
{
    CFileFind tempFind;
    char tempFileFind[MAX_PATH];
    sprintf(tempFileFind,"%s\\*.*",DirName);
    BOOL IsFinded=(BOOL)tempFind.FindFile(tempFileFind);
    while(IsFinded)
    {
        IsFinded=(BOOL)tempFind.FindNextFile();
        if(!tempFind.IsDots())
        {
            char foundFileName[MAX_PATH];
            strcpy(foundFileName,tempFind.GetFileName().GetBuffer(MAX_PATH));
            if(tempFind.IsDirectory())
            {
                char tempDir[MAX_PATH];
                sprintf(tempDir,"%s\\%s",DirName,foundFileName);
                DeleteDirectory(tempDir);
            }
            else
            {
                char tempFileName[MAX_PATH];
                sprintf(tempFileName,"%s\\%s",DirName,foundFileName);
                DeleteFile(tempFileName);
            }
        }
    }
    tempFind.Close();
    if(!RemoveDirectory(DirName))
    {
        //MessageBox(0,"删除目录失败!","警告信息",MB_OK);//比如没有找到文件夹,删除失败,可把此句删除
        return FALSE;
    }
    return TRUE;
}
开发者ID:GCXIAOZHU,项目名称:OCR,代码行数:35,代码来源:OCR_Capture_ExampleDlg.cpp

示例12: DelDB

 void DelDB(char* pDb)
 {
    char loc[256];
	char locfile[256];
	CFileFind finder;
	strcpy(locfile,pDb);                    //<---所要删除的目录的路径  
	strcpy(loc,pDb);                        //<---所要删除的目录的路径
    strcat(locfile , "\\*.*");              //<---该目录下所有的文件
	int bWorking = finder.FindFile(locfile);
	while(bWorking)
	{
      bWorking = finder.FindNextFile();
	  if (finder.IsDots())
         continue;
	  
      if (!finder.IsDirectory())
      {
		 CString str = finder.GetFilePath();
		 CFile::Remove( str );
		  }   	  
	}
	finder.Close();

    //删除空目录--->
    if( _rmdir( loc ) == 0 )
    	std::cout<<"Directory "<<loc<<" was successfully removed\n";
    else 
	 	std::cout<<"Can not remove database"<<loc<<"\n";

    ResetDBinfo();                          //<---删除数据库之后将全局路径重新设置
    
 }
开发者ID:V756568,项目名称:MiniSQL,代码行数:32,代码来源:Display.cpp

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

示例14:

void KModelEditorTagExport::OnCbnSelchangeCombo2()
{
	// TODO: Add your control notification handler code here
	CFileFind Find;
	TCHAR strFind[MAX_PATH];
	m_ListBox_Target.ResetContent();
	int nCurSel = m_comboTarget.GetCurSel();
	KG_PROCESS_ERROR(nCurSel != CB_ERR);
	m_comboTarget.GetLBText(nCurSel, m_strTarget);

	sprintf_s(strFind,"%s%s\\动作\\*.ani",m_strPath,m_strTarget);
	BOOL bReturn = Find.FindFile(strFind);
	while (bReturn)
	{
		bReturn = Find.FindNextFile();
		if (!Find.IsDirectory())
		{
			if (Find.GetFileName() != "." && Find.GetFileName() != ".." &&Find.GetFileName().MakeLower() != ".svn")
			{
				char strName[MAX_PATH];
				CString strFileName = Find.GetFileName();
				_splitpath(strFileName, NULL, NULL, strName, NULL);
				m_ListBox_Target.AddString(strName);			
			}
		}
	}
Exit0:
	;
}
开发者ID:viticm,项目名称:pap2,代码行数:29,代码来源:KModelEditorTagExport.cpp

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


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