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


C++ PathFindExtension函数代码示例

本文整理汇总了C++中PathFindExtension函数的典型用法代码示例。如果您正苦于以下问题:C++ PathFindExtension函数的具体用法?C++ PathFindExtension怎么用?C++ PathFindExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: operator

			bool operator()(const FILE_TO_ADD& a,const FILE_TO_ADD& b){
				//sort by ext
				int ret=stricmp(PathFindExtension(a.relativePath.c_str()),PathFindExtension(b.relativePath.c_str()));
				if(ret==0){
					//sort by path if ext is same
					return stricmp(a.relativePath.c_str(),b.relativePath.c_str())<0;
				}else{
					return ret<0;
				}
			}
开发者ID:dzzie,项目名称:libs,代码行数:10,代码来源:tarcmd.cpp

示例2: utf8_to_wstring

FileType FileWatcherBaseWindows::platformFileType(std::string filename)
{
    if(FileExtensions.find(wstring_to_utf8(PathFindExtension(
                     utf8_to_wstring(filename).c_str()
                                             ))) != FileExtensions.end())
    {
        return FileExtensions.at(wstring_to_utf8(PathFindExtension(utf8_to_wstring(filename).c_str())));
    }

    else return FileType::ftFILE;
}
开发者ID:Michanne,项目名称:AutoInclude,代码行数:11,代码来源:FileWatcherWindows.cpp

示例3: IsImage

BOOL IsImage(const TCHAR *szFileName)
{
    static const TCHAR *IMAGE_EXTS[] = {_T("bmp"),_T("ico"),
                                        _T("gif"),_T("jpg"),_T("exf"),_T("png"),_T("tif"),_T("wmf"),_T("emf"),_T("tiff")
                                       };
    TCHAR *ext;
    int i = 0;

    ext = PathFindExtension(szFileName);

    if(ext == NULL || (ext + 1) == NULL)
    {
        return FALSE;
    }

    ext++;

    for(i = 0; i < SIZEOF_ARRAY(IMAGE_EXTS); i++)
    {
        if(lstrcmpi(ext, IMAGE_EXTS[i]) == 0)
        {
            return TRUE;
        }
    }

    return FALSE;
}
开发者ID:RenniePet,项目名称:explorerplusplus,代码行数:27,代码来源:Helper.cpp

示例4: GetPrivateProfilePath

static int GetPrivateProfilePath(TCHAR *ini_file)
{
    int ret = -1;

    // Allocate string buffers
    TCHAR *process_path = new TCHAR[FILE_PATH_MAX];
    if (!process_path)
        goto EXIT;
    // Initliaze string buffers.
    memset(process_path, 0, sizeof(TCHAR) * FILE_PATH_MAX);

    // Get the full path name of the running process.
    DWORD dwRet = GetModuleFileName(NULL, process_path, sizeof(TCHAR) * FILE_PATH_MAX);
    if (dwRet == 0)
        goto EXIT;

    // Generate the ini file path.
    _tcscpy_s(ini_file, FILE_PATH_MAX, process_path);
    TCHAR *pExt = PathFindExtension(ini_file);
    _tcscpy_s(pExt, 5, _T(".ini"));

    ret = 0;
EXIT:
    SAFE_DELETE_ARRAY(process_path);

    return ret;
}
开发者ID:iGlitch,项目名称:Caption2Ass,代码行数:27,代码来源:IniFile.cpp

示例5: ext

BOOL CChordEaseDoc::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
{
	CString	ext(PathFindExtension(lpszPathName));
	if (!ext.CompareNoCase(LEAD_SHEET_EXT))	// if lead sheet extension
		lpszPathName = NULL;	// force SaveAs to native file extension
	return CDocument::DoSave(lpszPathName, bReplace);
}
开发者ID:victimofleisure,项目名称:ChordEase,代码行数:7,代码来源:ChordEaseDoc.cpp

示例6: _itot

void CMainDlg::OnAdd()
{
	
	int nCount = m_wndAccountListView.GetItemCount();
	nCount++;
	TCHAR szRowIndex[20]={0};
	_itot(nCount,szRowIndex,10);
	TCHAR  szFilter[] = _T("Pdf Files (*.Pdf)\0*.Pdf\0All Files (*.*)\0*.*\0\0");

	CFileDialog dlg(true,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,szFilter,this->m_hWnd);
	WCHAR strBuffer[65535] = {0};
	dlg.m_ofn.lpstrFile = strBuffer;
	dlg.m_ofn.nMaxFile = 65535;
	TCHAR infilename[MAX_PATH]={0};
	if(dlg.DoModal() == IDOK )
	{
		CString strbuf;
		TCHAR* pFilePath =NULL;
		TCHAR szFileDirectory[MAX_PATH]={0};
		pFilePath = dlg.m_ofn.lpstrFile;
		_tcscpy(szFileDirectory,pFilePath);
		TCHAR* szFileTitle = dlg.m_ofn.lpstrFileTitle;
		PathRemoveFileSpec(szFileDirectory);
		TCHAR* szExt = PathFindExtension(pFilePath);
		int nSize = GetContextFileSize(pFilePath);
		TCHAR szSize[MAX_PATH]={0};
		_stprintf(szSize,_T("%dK"),nSize);
		int nItem = m_wndAccountListView.Append(szRowIndex,NULL,0,LISTITEM_CHECKBOX);
		m_wndAccountListView.AppendSubItem(nItem,szFileTitle);
		m_wndAccountListView.AppendSubItem(nItem,szFileDirectory);
		m_wndAccountListView.AppendSubItem(nItem,szExt);
		m_wndAccountListView.AppendSubItem(nItem,szSize);
	}

}
开发者ID:charlessoft,项目名称:kui_demo_2,代码行数:35,代码来源:MainDlg.cpp

示例7: fileAutoRename

BOOL fileAutoRename(PSTR szName,DWORD dwName)
{
  char   szPath[_MAX_PATH];
  char   szTemp[_MAX_PATH];
  char   szExt[_MAX_PATH];
  PSTR   pName,pExt,pOrd;
  DWORD  dwOrd;
  HANDLE hFile;
  
  //not exist ?
  if (INVALID_HANDLE_VALUE != (hFile=CreateFile(szName,GENERIC_WRITE,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL))){
    CloseHandle(hFile);
	return TRUE;
  }
  strcpyN(szPath,sizeof(szPath),szName);
  pName = PathFindFileName(szPath);
  pExt  = PathFindExtension(pName);
  strcpyN(szExt,sizeof(szExt),pExt);
  pOrd = pExt - 1;
  for(;;pOrd++){
    if (*pOrd < '0' || *pOrd > '9') break;
  }
  pOrd++;
  dwOrd = atoi(pOrd);
  pOrd[0] = 0;
  for(;dwOrd<INT_MAX-1;dwOrd++){
    strcpyV(szTemp,sizeof(szTemp),"%s%d%s",szPath,dwOrd,szExt);
	if (INVALID_HANDLE_VALUE != (hFile=CreateFile(szTemp,GENERIC_WRITE,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL))){
      CloseHandle(hFile);
	  strcpyN(szName,dwName,szTemp);
      return TRUE;
    }
  }
  return FALSE;
}
开发者ID:cirosantilli,项目名称:netWork-fork,代码行数:35,代码来源:fileLib.c

示例8: OnFileSaveAs

void CKaiDoc::OnFileSave()
{
    // TODO: Add your command handler code here
    if (pco_Doc_->b_IsImported())
    {
        OnFileSaveAs();
        return;
    }

    CString cstr_path = GetPathName();
    if (!cstr_path.IsEmpty())
    {
        CString cstr_ext = PathFindExtension (cstr_path);
        SetPathName (CString (cstr_path.Left (cstr_path.GetLength() - 
                                              cstr_ext.GetLength())) + 
                              _T(".kai"));
    }
    else
    {
        SetTitle (pco_Doc_->str_Title_.data());
    }

    CDocument::OnFileSave();

    if (IsModified())
    {
        SetTitle (CString (pco_Doc_->str_Title_.data()) + _T("*"));
    }

}
开发者ID:kbogatyrev,项目名称:Kai,代码行数:30,代码来源:KaiDoc.cpp

示例9: clmSrc

BOOL CLZSS::Decomp(CArcFile* pclArc, DWORD dwDicSize, DWORD dwDicPtr, DWORD dwLengthOffset)
{
	SFileInfo* pstFileInfo = pclArc->GetOpenFileInfo();

	// Read
	DWORD          dwSrcSize = pstFileInfo->sizeCmp;
	YCMemory<BYTE> clmSrc(dwSrcSize);
	pclArc->Read(&clmSrc[0], dwSrcSize);

	// Buffer allocation for extraction
	DWORD          dwDstSize = pstFileInfo->sizeOrg;
	YCMemory<BYTE> clmDst(dwDstSize);

	// Decompression
	Decomp(&clmDst[0], dwDstSize, &clmSrc[0], dwSrcSize, dwDicSize, dwDicPtr, dwLengthOffset);

	// Bitmap
	if (lstrcmp(PathFindExtension(pstFileInfo->name), _T(".bmp")) == 0)
	{
		CImage clImage;
		clImage.Init(pclArc, &clmDst[0]);
		clImage.Write(dwDstSize);
		clImage.Close();
	}
	else // Other
	{
		pclArc->OpenFile();
		pclArc->WriteFile(&clmDst[0], dwDstSize);
		pclArc->CloseFile();
	}

	return TRUE;
}
开发者ID:angathorion,项目名称:ExtractData,代码行数:33,代码来源:LZSS.cpp

示例10: REQUIRED

   /// <summary>Determines whether path has a given extension (case insensitive)</summary>
   /// <param name="ext">The extention preceeded by a dot</param>
   /// <returns></returns>
   /// <exception cref="Logic::ArgumentNullException">Path is null</exception>
   bool  Path::HasExtension(const WCHAR* ext) const
   {
      REQUIRED(ext);

      // Optimization for usage with literals
      return StrCmpI(PathFindExtension(Buffer.get()), ext) == 0;
   }
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:11,代码来源:Path.cpp

示例11: if

void CUpdateServersDlg::OnTimer(UINT_PTR nIDEvent)
{
	CSkinDialog::OnTimer( nIDEvent );

	if ( m_pRequest.IsPending() )
	{
		int n = m_wndProgress.GetPos();
		if ( n < 5 )
			n = 5;
		else if ( n < 100 )
			n++;
		m_wndProgress.SetPos( n );
	}
	else
	{
		KillTimer( 1 );

		if ( m_pRequest.GetStatusSuccess() )
		{
			const CString strExt = CString( PathFindExtension( m_sURL ) ).MakeLower();
			if ( strExt == L".met" || m_sURL.Find( _T("//server"), 8 ) > 8 )		// || strExt == L".php"
				Settings.eDonkey.ServerListURL = m_sURL;
			else if ( strExt == L".bz2" || m_sURL.Find( _T("hublist"), 8 ) > 8 )
				Settings.DC.HubListURL = m_sURL;
		//	else if ( strExt == L".xml" )
		//		Settings.Gnutella.CacheURL = m_sURL;
		//	else if ( strExt == L".dat" )
		//		Settings.KAD.NodesListURL = m_sURL;

			const CBuffer* pBuffer = m_pRequest.GetResponseBuffer();

			CMemFile pFile;
			pFile.Write( pBuffer->m_pBuffer, pBuffer->m_nLength );
			pFile.Seek( 0, CFile::begin );

			if ( ( strExt == L".bz2" && HostCache.ImportHubList( &pFile ) ) ||
				 HostCache.ImportMET( &pFile ) )
			//	 HostCache.ImportCache( &pFile ) || 	// ToDo: G2/Gnutella loading
			//	 HostCache.ImportNodes( &pFile ) )		// ToDo: KAD
			{
				HostCache.Save();

				m_sURL.Empty();
				EndDialog( IDOK );
				return;
			}
		}

		CString strError;
		strError.Format( LoadString( IDS_DOWNLOAD_DROPPED ), m_sURL );
		MsgBox( strError, MB_OK | MB_ICONEXCLAMATION );

		m_sURL.Empty();
		EndDialog( IDCANCEL );
	}

	UpdateWindow();
}
开发者ID:lemonxiao0,项目名称:peerproject,代码行数:58,代码来源:DlgUpdateServers.cpp

示例12: wmain

int wmain(int argc, WCHAR* argv[])
{
	if ((argc == 1) || ((argc == 2) && (lstrcmpi(argv[1], L"/?") == 0)))
	{
		ShowUsage();
		return E_INVALIDARG;
	}

	int i = argc - 1;

	//File name is always the last option
	LPCWSTR szFilePath = argv[i];

	//Find whether the file is a .exe or a .dll
	LPCWSTR szExtension = PathFindExtension(szFilePath);

	bool bExe = false;
	bool bCurrentUser = false;
	bool bUnregister = false;

	if (lstrcmpi(szExtension, TEXT(".exe")) == 0)
		bExe = true;
	//else default to dll

	//Parse the command line to find the other options
	i--;

	while(i > 0)
	{
		if (lstrcmpi(argv[i], L"/u") == 0)
			bUnregister = true;
		else if (lstrcmpi(argv[i], L"/c") == 0)
			bCurrentUser = true;
//		else
//		{
//			//Ignore the option
//		}

		i--;
	}

	HRESULT hr;

	if (bExe)
	{
		hr = RegisterExe(szFilePath, bUnregister, bCurrentUser);
	}
	else
	{
		hr = RegisterDll(szFilePath, bUnregister, bCurrentUser);
	}

	if (FAILED(hr))
		ShowErrorMessage(hr);

	return hr;
}
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:57,代码来源:RegSvrEx.cpp

示例13: ListFileInDirection

	void ListFileInDirection(const char * path, const char * extension, const std::function<void(const char *, const char *)> &f) {
#ifdef WIN32
		WIN32_FIND_DATA finder;

		char tmp[512] = { 0 };
		SafeSprintf(tmp, sizeof(tmp), "%s/*.*", path);

		HANDLE handle = FindFirstFile(path, &finder);
		if (INVALID_HANDLE_VALUE == handle)
			return;

		while (FindNextFile(handle, &finder)) {
			if (strcmp(finder.cFileName, ".") == 0 || strcmp(finder.cFileName, "..") == 0)
				continue;

			SafeSprintf(tmp, sizeof(tmp), "%s/%s", path, finder.cFileName);
			if (finder.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
				ListFileInDirection(tmp, extension, f);
			else {
				if (0 == strcmp(extension, PathFindExtension(finder.cFileName))) {
					PathRemoveExtension(finder.cFileName);
					f(finder.cFileName, tmp);
				}
			}
		}
#else
		DIR * dp = opendir(path);
		if (dp == nullptr)
			return;

		struct dirent * dirp;
		while ((dirp = readdir(dp)) != nullptr) {
			if (dirp->d_name[0] == '.')
				continue;

			char tmp[256] = { 0 };
			SafeSprintf(tmp, sizeof(tmp), "%s/%s", path, dirp->d_name);

			struct stat st;
			if (stat(tmp, &st) == -1)
				continue;

			if (S_ISDIR(st.st_mode))
				ListFileInDirection(tmp, extension, f);
			else {
				if (0 == strcmp(extension, GetFileExt(dirp->d_name))) {
					char name[256];
					SafeSprintf(name, sizeof(name), "%s", dirp->d_name);
					char * dot = strrchr(name, '.');
					if (dot != nullptr)
						*dot = 0;
					f(name, tmp);
				}
			}
		}
#endif
	}
开发者ID:ooeyusea,项目名称:hyper_net,代码行数:57,代码来源:tools.cpp

示例14: ShellExecute

LRESULT CFileTreeView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if (ID_POPMENU_OPEN == wParam)
	{
		std::wstring path = m_Org.GetSelectedPath();
		ShellExecute(NULL, _T("open"), path.c_str(), 0, 0, SW_SHOWNORMAL);
	}
	else if (ID_POPMENU_OPENIN == wParam)
	{
		std::wstring path = m_Org.GetSelectedPath();
		if (0 == wcscmp(L".boo", PathFindExtension(path.c_str())))
		{
			::SendMessage(GetParent(), WM_USER_MAINFRM_OPENFILE, (WPARAM)path.c_str(), 0);
		}
	}
	else if (ID_POPMENU_USEASROOT == wParam)
	{
		std::wstring path = m_Org.GetSelectedPath();
		CString strDir = path.c_str();
		strDir.TrimLeft();
		strDir.TrimRight();
		strDir.Replace(L'/', L'\\');
		if (strDir.IsEmpty())
		{
			m_Org.SetRootFolder(NULL);
			m_editDir.m_strDir = strDir;
		}
		else
		{
			//CString tmp = strDir.Right(1);
			if (L"\\" != strDir.Right(1))
			{
				strDir += L"\\";
			}
			DWORD hFillAtt = GetFileAttributes((LPCWSTR)strDir);
			if (INVALID_FILE_ATTRIBUTES == hFillAtt)
			{
				MessageBox( _T("Invalidat directory."), _T("Warning"), MB_OK|MB_ICONEXCLAMATION);
			}
			else
			{
				m_editDir.m_strDir = strDir;
				//::PostMessage(GetParent(), WM_USER_CHANG_DIR, 0, 0);
				//m_strDir = szDir;
			}
		}
		m_editDir.SetWindowText((LPCWSTR)(m_editDir.m_strDir));
		m_editDir.SetSel(m_editDir.m_strDir.GetLength(), m_editDir.m_strDir.GetLength());
		//m_editDir.SetFocus();

		TreeView_SelectItem(m_Org.m_hWnd, NULL);
		m_Org.SetRootFolder((LPCWSTR)m_editDir.m_strDir);
		RecordMemberVariable();
	}
	return 0;
}
开发者ID:anonymous1999,项目名称:BooguNote,代码行数:56,代码来源:FileTreeView.cpp

示例15: PathFindExtension

BOOL CSecureRule::Match(const CEnvyFile* pFile) const
{
	if ( m_nType == srAddress || m_nType == srContentRegExp || m_nType == srExternal || ! ( pFile && m_pContent ) )
		return FALSE;

	if ( m_nType == srSizeType )
	{
		if ( pFile->m_nSize == 0 || pFile->m_nSize == SIZE_UNKNOWN )
			return FALSE;

		LPCTSTR pszExt = PathFindExtension( (LPCTSTR)pFile->m_sName );
		if ( *pszExt != L'.' )
			return FALSE;
		pszExt++;

		CString strFilter = (LPCTSTR)m_pContent;
		strFilter = strFilter.Mid( 5 );		// "size:"
		if ( ! StartsWith( strFilter, pszExt ) )
			return FALSE;

		strFilter = strFilter.Mid( strFilter.Find( L':' ) + 1 );

		if ( strFilter.Find( L':' ) > 0 )
		{
			QWORD nLower, nUpper, nSize = pFile->m_nSize;
			_stscanf( (LPCTSTR)strFilter, L"%I64i:%I64i", &nLower, &nUpper );
			return nSize >= nLower && nSize <= nUpper;
		}
		if ( strFilter.Find( L'-' ) > 0 )
		{
			QWORD nLower, nUpper, nSize = pFile->m_nSize;
			_stscanf( (LPCTSTR)strFilter, L"%I64i-%I64i", &nLower, &nUpper );
			return nSize >= nLower && nSize <= nUpper;
		}

		CString strCompare;
		strCompare.Format( L"size:%s:%I64i", pszExt, pFile->m_nSize );
		return strCompare == (CString)m_pContent;
	}

	if ( m_nType == srContentHash )
	{
		LPCTSTR pszHash = m_pContent;
		if ( m_nContentLength < 30 || _tcsnicmp( pszHash, L"urn:", 4 ) != 0 )
			return FALSE;

		return
			( pFile->m_oSHA1  && pFile->m_oSHA1.toUrn() == pszHash ) ||		// Not Match( pFile->m_oSHA1.toUrn() )
			( pFile->m_oTiger && pFile->m_oTiger.toUrn() == pszHash ) ||
			( pFile->m_oED2K  && pFile->m_oED2K.toUrn() == pszHash ) ||
			( pFile->m_oBTH   && pFile->m_oBTH.toUrn() == pszHash ) ||
			( pFile->m_oMD5   && pFile->m_oMD5.toUrn() == pszHash );
	}

	return Match( pFile->m_sName );
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:56,代码来源:SecureRule.cpp


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