本文整理汇总了C++中FilePath::GetFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::GetFilename方法的具体用法?C++ FilePath::GetFilename怎么用?C++ FilePath::GetFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::GetFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetGPUForPathname
eGPUFamily GPUFamilyDescriptor::GetGPUForPathname(const FilePath &pathname)
{
const String filename = pathname.GetFilename();
for(int32 i = 0; i < GPU_FAMILY_COUNT; ++i)
{
eGPUFamily gpu = (eGPUFamily)i;
String strForFind(Format(".%s.", gpuData[gpu].name.c_str()));
if(String::npos != filename.rfind(strForFind))
{
return gpu;
}
}
return GPU_UNKNOWN;
}
示例2: AbsoluteToRelative
String FilePath::AbsoluteToRelative(const FilePath &directoryPathname, const FilePath &absolutePathname)
{
if(absolutePathname.IsEmpty())
return String();
DVASSERT(directoryPathname.IsDirectoryPathname());
Vector<String> folders;
Vector<String> fileFolders;
if(directoryPathname.GetType() == PATH_IN_RESOURCES && absolutePathname.GetType() == PATH_IN_RESOURCES)
{
Split(directoryPathname.absolutePathname, "/", folders);
Split(absolutePathname.GetDirectory().absolutePathname, "/", fileFolders);
}
else
{
Split(directoryPathname.GetAbsolutePathname(), "/", folders);
Split(absolutePathname.GetDirectory().GetAbsolutePathname(), "/", fileFolders);
}
Vector<String>::size_type equalCount = 0;
for(; equalCount < folders.size() && equalCount < fileFolders.size(); ++equalCount)
{
if(folders[equalCount] != fileFolders[equalCount])
{
break;
}
}
String retPath = "";
for(Vector<String>::size_type i = equalCount; i < folders.size(); ++i)
{
retPath += "../";
}
for(Vector<String>::size_type i = equalCount; i < fileFolders.size(); ++i)
{
retPath += fileFolders[i] + "/";
}
return (retPath + absolutePathname.GetFilename());
}