本文整理汇总了C++中PathName::AppendExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::AppendExtension方法的具体用法?C++ PathName::AppendExtension怎么用?C++ PathName::AppendExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathName
的用法示例。
在下文中一共展示了PathName::AppendExtension方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fileName
bool
SessionImpl::FindFileInternal (/*[in]*/ const char * lpszFileName,
/*[in]*/ FileType fileType,
/*[in]*/ bool firstMatchOnly,
/*[in]*/ bool tryHard,
/*[in]*/ bool create,
/*[in]*/ bool renew,
/*[out]*/ vector<PathName> & result)
{
MIKTEX_ASSERT (result.empty());
// try to derive the file type
if (fileType == FileType::None)
{
fileType = DeriveFileType(lpszFileName);
if (fileType == FileType::None)
{
trace_filesearch->WriteFormattedLine (
"core",
T_("cannot derive file type from %s"),
Q_(lpszFileName));
return (false);
}
}
if (renew)
{
if (! TryCreateFile(lpszFileName, fileType))
{
return (false);
}
}
// construct the search vector
PathNameArray vec = ConstructSearchVector(fileType);
// get the file type information
const InternalFileTypeInfo * pFileTypeInfo = GetInternalFileTypeInfo(fileType);
MIKTEX_ASSERT (pFileTypeInfo != 0);
// check to see whether the file name has a registered file name extension
const char * lpszExtension = GetFileNameExtension(lpszFileName);
bool hasRegisteredExtension = false;
if (lpszExtension != 0)
{
for (CSVList ext (pFileTypeInfo->fileNameExtensions.c_str(),
PATH_DELIMITER);
ext.GetCurrent() != 0 && ! hasRegisteredExtension;
++ ext)
{
if (PathName::Compare(lpszExtension, ext.GetCurrent()) == 0)
{
hasRegisteredExtension = true;
}
}
for (CSVList ext (pFileTypeInfo->alternateExtensions.c_str(),
PATH_DELIMITER);
ext.GetCurrent() != 0 && ! hasRegisteredExtension;
++ ext)
{
if (PathName::Compare(lpszExtension, ext.GetCurrent()) == 0)
{
hasRegisteredExtension = true;
}
}
}
vector<PathName> fileNamesToTry;
// try each registered file name extension, if none was specified
if (! hasRegisteredExtension)
{
for (CSVList ext (pFileTypeInfo->fileNameExtensions.c_str(),
PATH_DELIMITER);
ext.GetCurrent() != 0;
++ ext)
{
PathName fileName (lpszFileName);
fileName.AppendExtension (ext.GetCurrent());
fileNamesToTry.push_back (fileName);
}
}
// try it with the given file name
fileNamesToTry.push_back (lpszFileName);
// first round: use the fndb
for (vector<PathName>::const_iterator it = fileNamesToTry.begin();
it != fileNamesToTry.end();
++ it)
{
if (FindFileInternal(it->Get(), vec, firstMatchOnly, true, false, result) && firstMatchOnly)
{
return (true);
}
}
// second round: don't use the fndb
if (tryHard)
{
//.........这里部分代码省略.........