本文整理汇总了C++中FindFile函数的典型用法代码示例。如果您正苦于以下问题:C++ FindFile函数的具体用法?C++ FindFile怎么用?C++ FindFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: devLock
CmtFileBase*
CmtFat::FileCreate( cpchar fname, int32 msMode ) {
FatDirEntry1x *ptr = 0;
CmtFileBase *file = 0;
devLock();
if( msMode & CMT_CREATE_WRITE ) {
//Открыть для записи
ptr = FindFile( fname );
//Если уже существует, то удалить файл
if( ptr && (msMode & CMT_FILE_RESET) ) {
DeleteFileEntry( ptr );
ptr = 0;
}
//Создать новый файл
if( ptr == 0 )
ptr = CreateFileName( fname );
}
else if( msMode & CMT_CREATE_READ ) {
//Открыть для чтения
ptr = FindFile( fname );
}
if( ptr ) {
//Файл найден
file = new CmtFatFile( this, ptr, msMode );
}
devUnLock();
return file;
}
示例2: FindFileSymbols
PTagArray FindFileSymbols(const char* file)
{
String filename=file;
filename.ToLower();
PTagArray ta=new TagArray;
for(int i=0;i<files.Count();i++)
{
if(files[i]->mainaload ||
files[i]->isLoadBase(filename))
{
int j=0;
while(filename[j]==files[i]->filename[j])j++;
while(filename[j-1]!='\\')j--;
if(files[i]->filename.Index("\\",j)==-1)
{
FindFile(files[i],filename.Substr(j),ta);
FindFile(files[i],filename,ta);
}
}
}
if(ta->Count()==0)
{
delete ta;
ta=NULL;
}
return ta;
}
示例3: RegisterInlineImage
void Driver::RegisterInlineImage(const string& filename,const string& tag)
{
string f=FindFile(filename,"graphics");
if(f=="")
{
cerr << "Warning: Image missing: "+filename << endl;
f=FindFile("q.png","graphics");
}
inlineimage[tag]=LoadImage(f,Color(0,0,0));
}
示例4: PathUtilsSuite_TestFindFile
void PathUtilsSuite_TestFindFile( PathUtilsSuiteData* data ) {
char* searchPaths = NULL;
char fullPath[1024];
const char* subDir = "./testSubDir";
const char* subDirFilename = "./testSubDir/subDirTest.xml";
const char* currDirFilename = "./currDirTest.xml";
Stg_asprintf( &searchPaths, ".:%s:/does/not/exist", subDir );
/* Create necessary test files/dirs */
if (data->rank==0) {
FILE* subDirFile = NULL;
FILE* currDirFile = NULL;
currDirFile = fopen( currDirFilename, "w" );
fputs( "test.\n", currDirFile );
fclose( currDirFile );
mkdir( subDir, 0755 );
subDirFile = fopen( subDirFilename, "w" );
fputs( "test.\n", subDirFile );
fclose( subDirFile );
}
MPI_Barrier(MPI_COMM_WORLD);
/* try and open some files using the search path */
/* Only do this using proc 0 - for why, see warning in Doxygen comment for the function. */
if (data->rank==0) {
/* This first test is to make sure it can handle files preceded with ./ */
FindFile( fullPath, currDirFilename, searchPaths );
pcu_check_streq( fullPath, currDirFilename );
FindFile( fullPath, "currDirTest.xml", searchPaths );
pcu_check_streq( fullPath, currDirFilename );
FindFile( fullPath, "subDirTest.xml", searchPaths );
pcu_check_streq( fullPath, subDirFilename );
FindFile( fullPath, "nofile.man", searchPaths );
pcu_check_streq( fullPath, "" );
FindFile( fullPath, "/Users/luke/Projects/StGermain/env_vars", searchPaths );
pcu_check_streq( fullPath, "" );
}
if (data->rank==0) {
remove( currDirFilename );
remove( subDirFilename );
rmdir( subDir );
}
}
示例5: PatientFindFile
bool PatientFindFile(const char* filePath, int numWaitTimes, int* waitTimes)
{
if ( FindFile(filePath) )
return true;
for ( int i = 0; i < numWaitTimes; i++ )
{
Sleep(waitTimes[i]);
if ( FindFile(filePath) )
return true;
}
return false;
}
示例6: Alloc_MaterialEffect
//----------------------------------------------------------------------------------------------
MaterialEffect* CFXMatManager::GetMaterialInstance(const char *Name)
{
std::string sFilename;
if (!FindFile(Name, &sFilename)){
return NULL;
}
MaterialEffect * pOutMatInstance = NULL;
std::map<std::string, m_material>::iterator IterFind = m_MapMatPrototypes.find(sFilename.c_str());
if (IterFind != m_MapMatPrototypes.end())
{
pOutMatInstance = Alloc_MaterialEffect(m_pRenderSDK->GetRenderDriver());
std::string sFXFilename;
if (FindFile(IterFind->second.fx_file.c_str(), &sFXFilename))
{
if (pOutMatInstance->Load(sFXFilename.c_str()))
{
pOutMatInstance->SetTechniqueName(IterFind->second.tehnique.c_str());
}
}
}
else
{
m_material OutMaterial;
if (Load(sFilename.c_str(), OutMaterial))
{
pOutMatInstance = Alloc_MaterialEffect(m_pRenderSDK->GetRenderDriver());
std::string sFXFilename;
if (FindFile(OutMaterial.fx_file.c_str(), &sFXFilename))
{
if (pOutMatInstance->Load(sFXFilename.c_str()))
{
pOutMatInstance->SetTechniqueName(OutMaterial.tehnique.c_str());
}
}
m_MapMatPrototypes.insert(std::make_pair(sFilename, OutMaterial));
}
}
return pOutMatInstance;
}
示例7: tmp
wxString Project::GetVDByFileName(const wxString& file)
{
//find the file under this node
// Convert the file path to be relative to
// the project path
DirSaver ds;
::wxSetWorkingDirectory(m_fileName.GetPath());
wxFileName tmp(file);
tmp.MakeRelativeTo(m_fileName.GetPath());
wxString path(wxEmptyString);
wxXmlNode *fileNode = FindFile(m_doc.GetRoot(), tmp.GetFullPath(wxPATH_UNIX));
if (fileNode) {
wxXmlNode *parent = fileNode->GetParent();
while ( parent ) {
if (parent->GetName() == wxT("VirtualDirectory")) {
path.Prepend(parent->GetPropVal(wxT("Name"), wxEmptyString));
path.Prepend(wxT(":"));
} else {
break;
}
parent = parent->GetParent();
}
}
wxString trunc_path(path);
path.StartsWith(wxT(":"), &trunc_path);
return trunc_path;
}
示例8: EmitAsmIncludes
void EmitAsmIncludes()
/*
Purpose:
Try to find corresponding .asm file for every used .atl file.
If it is found, generate include instruction to output file.
*/
{
Var * var;
Instr i;
FILE * f;
char name[MAX_PATH_LEN], path[MAX_PATH_LEN];
UInt16 len;
MemEmptyVar(i);
i.op = INSTR_INCLUDE;
for(var = VarFirst(); var != NULL; var = VarNext(var)) {
if (var->mode == INSTR_SRC_FILE) {
if (FlagOff(var->submode, SUBMODE_MAIN_FILE)) {
strcpy(name, var->name);
len = StrLen(name);
name[len-4] = 0;
f = FindFile(name, ".asm", path);
if (f != NULL) {
fclose(f);
i.arg1 = VarNewStr(FILENAME);
EmitInstr(&i);
}
}
}
}
}
示例9: FindFile
BOOL CSearcher::IsSomeThingInPath(const CString& dirPath, const CString& fullFileName)
{
CString searchPathName;
searchPathName.Format("%s\\%s", dirPath, "*.*"); // search all
return FindFile(searchPathName);
}
示例10: qDebug
void CGI_SCADA_DLL_HistoryMessageItem::slot_OpenProject(QString strProjectPath)
{
qDebug()<<__func__<<__FILE__<<__LINE__;
CGI_SCADA_DLL_TreeItemBase::slot_OpenProject(strProjectPath);
m_DBFileList.clear();
FindFile(strProjectPath);
}
示例11: FindFile
int HTMLProject::FindLabel(const HTMLLabel *label)
{
HTMLFile *file = label->GetFile();
int fn = FindFile(file);
delete file;
if (fn<0)
return -1;
unsigned int n = labelList->CountItems();
if (n==0)
return -1;
for (unsigned int i=0; i<n; i++)
{
smallLabel *lab = (smallLabel*)labelList->ItemAt(i);
if (lab->file == (unsigned int)fn)
{
if (lab->label == label->lname)
return i;
}
else
if (lab->file > (unsigned int)fn)
return -1;
}
return -1;
}
示例12: FindFile
const IStream* FileStorage::ReadFile(const StringRef& path, DirectoryEntry* parent /*= nullptr*/, FileDataType dataType /*= FileDataType::Binary*/)const
{
const FileEntry* fileEntry = FindFile(path, parent);
RETURN_NULL_IF_NULL(fileEntry);
return ReadFileHelper(*fileEntry, dataType);
}
示例13: Release
// 从文件读取原始列表
BOOL CSkillList::LoadSkillList(const char* stepfilename, const char* dir_name)
{
Release();
// 读取技能名称对应的CommandID
char *index="SkillStep";
CIni Ini("data/SkillStep.ini");
int num=Ini.GetContinueDataNum(index);
for(int i=0; i<num; i++)
{
int nCommandID;
char *tmp=Ini.ReadCaption(index, i);
nCommandID=atoi(tmp); //获得指令Id
SAFE_DELETE(tmp);
tmp=Ini.ReadText(index, i);
m_mapStepNameID[tmp]=nCommandID;
SAFE_DELETE(tmp);
}
// 读取目录中的所有技能文件
list<string> listFileName;
FindFile(dir_name, ".skill", &listFileName);
for(list<string>::iterator it=listFileName.begin(); it!=listFileName.end(); it++)
{
const char* filename = it->c_str();
LoadOneSkill(filename);
}
return true;
}
示例14: spec
void CStateDownload::ScanDirectory(RFs& aFs, const TDesC& aDir, const TDesC& aWild, CDesCArray* aFilesArray)
{
TParse parse;
parse.Set(aWild, &aDir, NULL);
TPtrC spec(parse.FullName());
TFindFile FindFile(aFs);
CDir* dir;
if (FindFile.FindWildByPath(parse.FullName(), NULL, dir) == KErrNone)
{
CleanupStack::PushL(dir);
TInt count=dir->Count();
for(TInt i = 0; i < count; i++)
{
parse.Set((*dir)[i].iName, &spec, NULL);
TEntry entry;
if(aFs.Entry(parse.FullName(),entry) == KErrNone)
{
if(!entry.IsDir())
{
//InsertIsqL raises a KErrAlreadyExists (-11) when inserting a duplicate
TRAPD(err,aFilesArray->InsertIsqL(parse.FullName()));
}
}
}
CleanupStack::PopAndDestroy(dir);
}
}
示例15: LOG
// Returns a string list of details about the file
// in the order EXISTS, DATE, SIZE
QStringList StorageGroup::GetFileInfo(QString filename)
{
LOG(VB_FILE, LOG_DEBUG, LOC +
QString("GetFileInfo: For '%1'") .arg(filename));
QStringList details;
bool searched = false;
if (!FileExists(filename))
{
searched = true;
filename = FindFile(filename);
}
if ((searched && !filename.isEmpty()) ||
(FileExists(filename)))
{
QFileInfo fInfo(filename);
details << filename;
details << QString("%1").arg(fInfo.lastModified().toTime_t());
details << QString("%1").arg(fInfo.size());
}
return details;
}