本文整理汇总了C++中PathName::GetExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::GetExtension方法的具体用法?C++ PathName::GetExtension怎么用?C++ PathName::GetExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathName
的用法示例。
在下文中一共展示了PathName::GetExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compare
STATICFUNC(int) MyPathNameCompare(const PathName& path1, const PathName& path2)
{
int ret = PathName::Compare(path1, path2);
if (ret == 0)
{
return 0;
}
string extension1 = path1.GetExtension();
string extension2 = path2.GetExtension();
if (extension1.empty() == extension2.empty())
{
// both have no extenion or both have an extension
return ret;
}
PathName path11(path1);
PathName path22(path2);
if (extension1.empty())
{
path11.AppendExtension(extension2);
}
else
{
MIKTEX_ASSERT(!path22.HasExtension());
path22.AppendExtension(extension1);
}
return PathName::Compare(path11, path22);
}
示例2: return
MyPathNameCompare (/*[in]*/ const PathName & path1,
/*[in]*/ const PathName & path2)
{
int ret = PathName::Compare(path1, path2);
if (ret == 0)
{
return (0);
}
const char * lpszExtension1 = path1.GetExtension();
const char * lpszExtension2 = path2.GetExtension();
if ((lpszExtension1 == 0 && lpszExtension2 == 0)
|| (lpszExtension1 != 0 && lpszExtension2 != 0))
{
return (ret);
}
PathName path11 (path1);
PathName path22 (path2);
if (lpszExtension1 == 0)
{
path11.AppendExtension (lpszExtension2);
}
else
{
path22.AppendExtension (lpszExtension1);
}
return (PathName::Compare(path11, path22));
}
示例3: ConvertToBitmapFile
bool SessionImpl::ConvertToBitmapFile(const PathName& sourceFileName, PathName& destFileName, IRunProcessCallback* callback)
{
string ext = sourceFileName.GetExtension();
if (ext.empty())
{
MIKTEX_FATAL_ERROR_2(T_("No file name extension in graphics rule."), "path", ext);
}
string rule;
if (!FindGraphicsRule(ext, ".bmp", rule))
{
MIKTEX_FATAL_ERROR_2(T_("No conversion rule found."), "path", sourceFileName.ToString());
}
destFileName.SetToTempFile();
#if defined(MIKTEX_WINDOWS)
Utils::RemoveBlanksFromPathName(destFileName);
#endif
string commandLine;
for (const char* lpsz = rule.c_str(); *lpsz != 0; ++lpsz)
{
if (*lpsz == '%')
{
++lpsz;
switch (*lpsz)
{
case 'i':
commandLine += sourceFileName.GetData();
break;
case 'o':
commandLine += destFileName.GetData();
break;
}
}
else
{
commandLine += *lpsz;
}
}
bool done = Process::ExecuteSystemCommand(commandLine, nullptr, callback, nullptr);
if (!done)
{
File::Delete(destFileName, { FileDeleteOption::TryHard });
}
return done;
}