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


C++ GetFileInfo函数代码示例

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


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

示例1: _T

void CSpyUserPanel::OnSpyFileItemActivated(wxListEvent& event)
{
    wxString strCurLocaitoin = m_pFileLocationText->GetValue();
    bool bIsRootLocation = strCurLocaitoin.Length() == 3 && strCurLocaitoin[1] == _T(':');
    wxString strItem = event.GetItem().GetText();
    wxString strNewLocation = strItem;
    if (strCurLocaitoin != _T("我的电脑"))
    {
        if (*strCurLocaitoin.rbegin() != _T('/'))
        {
            strCurLocaitoin.append(_T("/"));
        }
        strNewLocation = strCurLocaitoin.append(strItem);
    }
    TCHAR szPath[MAX_PATH];
    if (strItem == _T("..") && bIsRootLocation)
    {
        szPath[0] = 0;
    }
    else
    {
        CFilePathTool::GetInstance()->Canonical(szPath, strNewLocation.c_str());
    }    
    GetFileInfo(szPath, false);
}
开发者ID:beyondlwm,项目名称:Beats,代码行数:25,代码来源:SpyUserPanel.cpp

示例2: cOsdMenu

cFileInfoMenu::cFileInfoMenu(std::string mrl) : cOsdMenu( tr("File Info:"), 12)
{
	//set title
	//SetTitle(tr("mediaplayer - Id3 Info:"));
	mrl_ = mrl;
	fileInfoVec_ = GetFileInfo(mrl_);

	// Get title
	std::string title;
	TagLib::FileRef f( mrl.c_str() );
	if(!f.isNull() && f.tag())
	{
		TagLib::Tag *tag = f.tag();
								 // unicode = false
		title   = tag->title().stripWhiteSpace().toCString(false)  ;

		if (title.size())
		{
			char buffer[128];
			snprintf(buffer, 127, "File Info: %s", title.c_str());
			SetTitle(buffer);
			printf("setting title to : %s\n", buffer);
		}
	}

	ShowInfo();
}
开发者ID:suborb,项目名称:reelvdr,代码行数:27,代码来源:fileInfoMenu.c

示例3: while

///////////////////////////////////////////////////////////////////////////////
//
// Search for the target using the vPath
fileinfo* mhmakefileparser::SearchvPath(const fileinfo* pTarget)
{
  string TargetName=pTarget->GetName();
  vector< pair< string, refptr<fileinfoarray> > >::iterator vPathIt=m_vPath.begin();
  while (vPathIt!=m_vPath.end())
  {
    matchres Res;

    if (PercentMatch(TargetName,vPathIt->first,&Res))
    {
      fileinfoarray::iterator pIt=vPathIt->second->begin();
      while (pIt!=vPathIt->second->end())
      {
        fileinfo* pNewTarget=GetFileInfo(TargetName,*pIt);
        mh_time_t TargetDate=StartBuildTarget(pNewTarget,false);
        if (!TargetDate.IsDateValid())
          TargetDate=WaitBuildTarget(pNewTarget);
        if (pNewTarget->GetDate().DoesExist())
          return pNewTarget;
        pIt++;
      }
    }
    vPathIt++;
  }
  return NULL;
}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:29,代码来源:mhmakefileparser.cpp

示例4: XLI_THROW_FILE_NOT_FOUND

        void UnixFileSystemBase::GetFiles(const String& path, Array<FileInfo>& list)
        {
            String prefix = 
                path.Length() > 0 && path.Last() != '/' ? 
                    path + "/" : 
                    path;

            DIR *dp;
            struct dirent *ep;

            if ((dp = opendir(prefix.Ptr())) == NULL)
                XLI_THROW_FILE_NOT_FOUND(prefix);

            if (prefix == "./")
                prefix = "";

            while ((ep = readdir(dp)) != NULL)
            {
                String fn = ep->d_name;
                
                if (fn == "." || fn == "..") 
                    continue;

                FileInfo info;
                if (GetFileInfo(prefix + fn, info))
                    list.Add(info);
            }

            closedir(dp);
        }
开发者ID:neodyme60,项目名称:Xli,代码行数:30,代码来源:UnixFileSystemBase.cpp

示例5: FindFirstFile

	FolderInfo FileSystem::GetFolderInfo(const String& path) const
	{
		FolderInfo res;
		res.path = path;

		WIN32_FIND_DATA f;
		HANDLE h = FindFirstFile(path + "/*", &f);
		if (h != INVALID_HANDLE_VALUE)
		{
			do
			{
				if (strcmp(f.cFileName, ".") == 0 || strcmp(f.cFileName, "..") == 0)
					continue;

				if (f.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
					res.folders.Add(GetFolderInfo(path + "/" + f.cFileName));
				else
					res.files.Add(GetFileInfo(path + "/" + f.cFileName));
			} while (FindNextFile(h, &f));
		}
		else
			mInstance->mLog->Error("Failed GetPathInfo: Error opening directory " + path);

		FindClose(h);

		return res;
	}
开发者ID:zenkovich,项目名称:o2,代码行数:27,代码来源:FileSystemImpl.cpp

示例6: nb_qfileinfo

int nb_qfileinfo(int handle)
{
    int     i;
    int     rc;
    char    FileName[128];
    char    temp[512];
    DWORD   gle;

    sprintf(FileName, "Thread_%05d.log", ProcessNumber);

    if ((i = FindHandle(handle)) == -1)
        return(-1);

    StartFirstTimer();
    rc = GetFileInfo(ftable[i].name, ftable[i].fd, NULL, NULL, NULL, NULL, NULL, NULL);
    gle = GetLastError();
    if (!rc)
    {
        EndFirstTimer(CMD_QUERY_FILE_INFO, 0);
        LeaveThread(0, "", CMD_QUERY_FILE_INFO);
        sprintf(temp, "File: qfileinfo failed for %s GLE(0x%x)\n", ftable[i].name, gle);
        if (verbose)
            printf("%s", temp);
        LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
        return(-1);
    }
    EndFirstTimer(CMD_QUERY_FILE_INFO, 1);

    return(0);
}
开发者ID:snktagarwal,项目名称:openafs,代码行数:30,代码来源:nbio.c

示例7: GetFileList

	bool GetFileList(const string &sStoragePath, string &sOutResponse)
	{
		START_FUNCTION_BOOL();
		ASSERTE(!sStoragePath.empty());

		const sizeint siStoragePathLength = sStoragePath.length();

		string_v vsFilesList;
		sizeint siFilesCount = FileUtils::GetFileListRecursive(sStoragePath.c_str(), vsFilesList);

		string sResult;
		sizeint siEstimatedLength = (sStoragePath.length() + 1) * siFilesCount;
		sResult.reserve(siEstimatedLength);

		for (sizeint siIndex = 0; siIndex < siFilesCount; ++siIndex)
		{
			string &sCurrentFile = vsFilesList[siIndex];
			ASSERTE(sCurrentFile.length() > siStoragePathLength);

			string sFileInfo;
			if (GetFileInfo(sCurrentFile, sFileInfo))
			{
				string sCurrentFileItem = sCurrentFile.substr(siStoragePathLength) + sFileInfo;
				sResult.append(sCurrentFileItem);
			}
		}

		sOutResponse = sResult;
		END_FUNCTION_BOOL();
	}
开发者ID:starand,项目名称:cpp,代码行数:30,代码来源:CloudUtils.cpp

示例8: GetFileInfo

bool CZipArchive::ExtractFile(WORD uIndex, LPCTSTR lpszPath, DWORD nBufSize)
{
	if (!nBufSize)
		return false;
	
	CFileHeader header;
	GetFileInfo(header, uIndex); // to ensure that slash and oem conversions take place
	CString szFile = lpszPath;
	szFile.TrimRight(_T("\\"));
	szFile += _T("\\") + GetFileDirAndName(header.m_szFileName); // just in case in the archive there are file names with drives
	if (IsFileDirectory(uIndex))
	{
		ForceDirectory(szFile);
		SetFileAttributes(szFile, header.m_uExternalAttr);
	}
	else
	{
		if (!OpenFile(uIndex))
			return false;
		ForceDirectory(GetFilePath(szFile));
		CFile f(szFile, CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite);
		DWORD iRead;
		CAutoBuffer buf(nBufSize);
		do
		{
			iRead = ReadFile(buf, buf.GetSize());
			if (iRead)
				f.Write(buf, iRead);
		}
		while (iRead == buf.GetSize());
		CloseFile(f);
	}	
	return true;
}
开发者ID:F5000,项目名称:spree,代码行数:34,代码来源:ZipArchive.cpp

示例9: GetFileInfo

bool FStreamingNetworkPlatformFile::IsReadOnly(const TCHAR* Filename)
{
	FFileInfo Info;
	GetFileInfo(Filename, Info);

	return Info.ReadOnly;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:7,代码来源:StreamingNetworkPlatformFile.cpp

示例10: AFCDirectoryOpen

// Finds the first file of a given directory. Must be used in conjunction with 
// the FindNext and FindClose methods. FindClose needn't be called if the call
// to FindFirst returned false.
//
// Returns:
//		true	if a file was found
//		false	if no file was found, or if there was an error
//
// Example:
//
//		CiPoTApi iPodApi;
//		t_iPodFileInfo info;
//		bool bFile;
//		t_iPodError status = iPodApi.OpenSession();
//
//		if (status == IPOD_ERR_OK) {
//			bFile = iPodApi.FindFirst(remotePath, &info);
//			while (bFile) {
//				printf("%s\n", info.findData.cFileName);
//				bFile = iPodApi.FindNext(&info);
//			}
//			iPodApi.FindClose(&info);
//
bool CiPoTApi::FindFirst(char *remotePath, t_iPodFileInfo *pInfo)
{
	t_AFCDirectory *pHandle;
	afc_error_t ret;
	char *pEntry;
	CMacPath MacPath;

	pInfo->pHandle = NULL;
	pInfo->remotePath = NULL;
	MacPath.SetWindowsPath(remotePath);
	ret = AFCDirectoryOpen(m_iPodConnection, MacPath.GetBuffer(), &pHandle);
	if (ret)
		return false;
	ret = AFCDirectoryRead(m_iPodConnection, pHandle, &pEntry);
	if (ret || pEntry == NULL) {
		// Broken link?
		AFCDirectoryClose(m_iPodConnection, pHandle);
		return false;
	}
	pInfo->remotePath = strdup(remotePath);
	pInfo->pHandle = pHandle;
	// Now, a special case with the Applications folder
	pInfo->appFolder = bTranslateApps && (
		!strcmp(remotePath, _T("\\User\\Applications")) ||
		!strcmp(remotePath, _T("\\var\\mobile\\Applications")) ||
		!strcmp(remotePath, _T("\\private\\var\\mobile\\Applications")));
	MacPath.SetString(pEntry);
	MacPath.GetWindowsPath(pInfo->findData.cFileName);
	GetFileInfo(0, pInfo);
	return true;
}
开发者ID:blitmaster,项目名称:T-PoT,代码行数:54,代码来源:iPoTApi.cpp

示例11: CoCreateInstance

HRESULT CMediaFileList::AddAudioFile(BSTR FilePath, IMediaFile **ppResult)
{
	HRESULT hr = CoCreateInstance(CLSID_MediaFile, NULL, 
							  CLSCTX_INPROC_SERVER, 
							  IID_IMediaFile, 
							  (void **)ppResult);

	if (FAILED(hr) || *ppResult == NULL)
		return E_POINTER;
	
	(*ppResult)->AddRef();
	(*ppResult)->put_FilePath(FilePath);
	
	double dDuration = 0;
	hr = GetFileInfo(FilePath, 0, &dDuration, 0, 0, 0, 0, 0, 0);
	
	if (SUCCEEDED(hr))
	{
		(*ppResult)->put_Duration(dDuration);
	}
	
	(*ppResult)->put_StartOffset(GetCurrentAudioLength());

	m_audioList.AddTail(*ppResult);
	
	(*ppResult)->AddRef();

	return S_OK;
}
开发者ID:BlackMael,项目名称:DirectEncode,代码行数:29,代码来源:MediaFileList.cpp

示例12: GetAvailableThemes

    static void GetAvailableThemes(std::vector<AvailableTheme> * outThemes)
    {
        Guard::ArgumentNotNull(outThemes, GUARD_LINE);

        outThemes->clear();

        NumPredefinedThemes = 0;
        for (auto predefinedTheme : PredefinedThemes)
        {
            AvailableTheme theme {};
            theme.Name = predefinedTheme.Theme->Name;
            outThemes->push_back(std::move(theme));

            NumPredefinedThemes++;
        }

        auto themesPattern = Path::Combine(GetThemePath(), "*.json");
        auto scanner = std::unique_ptr<IFileScanner>(Path::ScanDirectory(themesPattern, true));
        while (scanner->Next())
        {
            auto fileInfo = scanner->GetFileInfo();
            auto name = Path::GetFileNameWithoutExtension(std::string(fileInfo->Name));

            AvailableTheme theme {};
            theme.Name = name;
            theme.Path = GetThemeFileName(theme.Name);
            outThemes->push_back(std::move(theme));

            if (Path::Equals(CurrentThemePath, scanner->GetPath()))
            {
                ActiveAvailableThemeIndex = outThemes->size() - 1;
            }
        }
    }
开发者ID:Wirlie,项目名称:OpenRCT2,代码行数:34,代码来源:Theme.cpp

示例13: FileLoadDrivers

long
FileLoadDrivers( char * dirSpec, long plugin )
{
    long         ret, length, flags, time, bundleType;
    long long	 index;
    long         result = -1;
    const char * name;
 
    if ( !plugin )
    {
        // First try 10.6's path for loading Extensions.mkext.
        if (FileLoadMKext(dirSpec, "Caches/com.apple.kext.caches/Startup/") == 0)
            return 0;

        // Next try the legacy path.
        else if (FileLoadMKext(dirSpec, "") == 0)
          return 0;

        strcat(dirSpec, "Extensions");
    }

    index = 0;
    while (1) {
        ret = GetDirEntry(dirSpec, &index, &name, &flags, &time);
        if (ret == -1) break;

        // Make sure this is a directory.
        if ((flags & kFileTypeMask) != kFileTypeDirectory) continue;
        
        // Make sure this is a kext.
        length = strlen(name);
        if (strcmp(name + length - 5, ".kext")) continue;

        // Save the file name.
        strcpy(gFileName, name);
    
        // Determine the bundle type.
        sprintf(gTempSpec, "%s/%s", dirSpec, gFileName);
        ret = GetFileInfo(gTempSpec, "Contents", &flags, &time);
        if (ret == 0) bundleType = kCFBundleType2;
        else bundleType = kCFBundleType3;

        if (!plugin)
            sprintf(gDriverSpec, "%s/%s/%sPlugIns", dirSpec, gFileName,
                    (bundleType == kCFBundleType2) ? "Contents/" : "");

        ret = LoadDriverPList(dirSpec, gFileName, bundleType);

        if (result != 0)
          result = ret;

        if (!plugin) 
          FileLoadDrivers(gDriverSpec, 1);
    }

    return result;
}
开发者ID:JayMonkey,项目名称:chameleon,代码行数:57,代码来源:drivers.c

示例14: GetFileInfo

int KHttpFile::Download()
{
    int nRetCode    = false;
    int nResult     = false;
    int nRetryCount = 0;

    nRetCode = GetFileInfo();
    KGLOG_PROCESS_ERROR(nRetCode);

    while (nRetryCount <= 5)
    {
        if (m_nFileSize == m_nDownloadedSize)
        {
            m_nErrorCode = dec_err_success;
            goto Exit1;
        }

        nRetCode = m_Downloader.Download(m_strUrl.c_str(), m_strFile.c_str());
        switch(nRetCode)
        {
        case HTTP_RESULT_SUCCESS:
        case HTTP_RESULT_SAMEAS:
            m_nErrorCode = dec_err_success;
            goto Exit1;
            break;

        case HTTP_RESULT_STOP:
            m_nErrorCode = dec_err_stop;
            goto Exit0;
            break;

        case HTTP_RESULT_FAIL:
            m_nErrorCode = dec_err_disconnection;
            KGLogPrintf(KGLOG_INFO, "disconnection retry %d", nRetryCount++);
            Sleep(5000);
            break;

        case HTTP_RESULT_REDIRECT_FTP:
        case HTTP_RESULT_REDIRECT_HTTP:
            m_nErrorCode = dec_err_cannotconnect;
            KGLogPrintf(KGLOG_INFO, "cannotconnect retry %d", nRetryCount++);
            Sleep(5000);
            break;

        default:
            m_nErrorCode = dec_err_cannotconnect;
            KGLOG_PROCESS_ERROR(false && "unknow result");
            break;
        }
    }

Exit1:
    nResult = true;
Exit0:
    KGLogPrintf(KGLOG_INFO, "download result= %d, filename = %s", m_nErrorCode, m_strFile.c_str());
    return nResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:57,代码来源:KHttpFile.cpp

示例15: GetModificationTime

CDateTime CLocalFileSystem::GetModificationTime( const wxString& path)
{
	CDateTime mtime;

	bool tmp;
	if (GetFileInfo(path, tmp, 0, &mtime, 0) == unknown)
		mtime = CDateTime();

	return mtime;
}
开发者ID:Typz,项目名称:FileZilla,代码行数:10,代码来源:local_filesys.cpp


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