本文整理汇总了C++中ogre::String::rfind方法的典型用法代码示例。如果您正苦于以下问题:C++ String::rfind方法的具体用法?C++ String::rfind怎么用?C++ String::rfind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::String
的用法示例。
在下文中一共展示了String::rfind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getConfigPaths
//---------------------------------------------------------------------
void FileSystemLayer::getConfigPaths()
{
// try to determine the application's path:
// recent systems should provide the executable path via the /proc system
Ogre::String appPath = resolveSymlink("/proc/self/exe");
if (appPath.empty())
{
// if /proc/self/exe isn't available, try it via the program's pid
pid_t pid = getpid();
char proc[64];
int retval = snprintf(proc, sizeof(proc), "/proc/%llu/exe", (unsigned long long) pid);
if (retval > 0 && retval < (long)sizeof(proc))
appPath = resolveSymlink(proc);
}
if (!appPath.empty())
{
// we need to strip the executable name from the path
Ogre::String::size_type pos = appPath.rfind('/');
if (pos != Ogre::String::npos)
appPath.erase(pos);
}
else
{
// couldn't find actual executable path, assume current working dir
appPath = ".";
}
// use application path as first config search path
mConfigPaths.push_back(appPath + '/');
// then search inside ../share/OGRE
mConfigPaths.push_back(appPath + "/../share/OGRE/");
// then try system wide /etc
mConfigPaths.push_back("/etc/OGRE/");
}
示例2: getConfigPaths
void FileSystemLayer::getConfigPaths()
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
// try to determine the application's path
DWORD bufsize = 256;
char* resolved = 0;
do
{
char* buf = OGRE_ALLOC_T(char, bufsize, Ogre::MEMCATEGORY_GENERAL);
DWORD retval = GetModuleFileName(NULL, buf, bufsize);
if (retval == 0)
{
// failed
OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
break;
}
if (retval < bufsize)
{
// operation was successful.
resolved = buf;
}
else
{
// buffer was too small, grow buffer and try again
OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
bufsize <<= 1;
}
} while (!resolved);
Ogre::String appPath = resolved;
if (resolved)
OGRE_FREE(resolved, Ogre::MEMCATEGORY_GENERAL);
if (!appPath.empty())
{
// need to strip the application filename from the path
Ogre::String::size_type pos = appPath.rfind('\\');
if (pos != Ogre::String::npos)
appPath.erase(pos);
}
else
{
// fall back to current working dir
appPath = ".";
}
#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
Ogre::String appPath;
if(!widePathToOgreString(appPath, Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data()))
{
// fallback to current working dir
appPath = ".";
}
#endif
// use application path as config search path
mConfigPaths.push_back(appPath + '\\');
}