本文整理汇总了C++中platform::FileManagerPtr::FileExists方法的典型用法代码示例。如果您正苦于以下问题:C++ FileManagerPtr::FileExists方法的具体用法?C++ FileManagerPtr::FileExists怎么用?C++ FileManagerPtr::FileExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类platform::FileManagerPtr
的用法示例。
在下文中一共展示了FileManagerPtr::FileExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fullHdVersionFileName
gs2d::str_type::string ETHSpriteDensityManager::ChooseSpriteVersion(const gs2d::str_type::string& fullFilePath,
const gs2d::VideoPtr& video, ETHSpriteDensityManager::DENSITY_LEVEL& densityLevel)
{
const Platform::FileManagerPtr fileManager = video->GetFileManager();
const bool shouldUseFullHdResources = ShouldUseFullHdResources(video);
if (shouldUseFullHdResources)
{
const string fullHdVersionFileName(AssembleResourceName(fullFilePath, FULL_HD_VERSION_PATH_NAME));
if (fileManager->FileExists(fullHdVersionFileName))
{
densityLevel = ETHSpriteDensityManager::FULL_HD;
return fullHdVersionFileName;
}
}
if (ShouldUseHdResources(video) || shouldUseFullHdResources)
{
const string hdVersionFileName(AssembleResourceName(fullFilePath, HD_VERSION_PATH_NAME));
if (fileManager->FileExists(hdVersionFileName))
{
densityLevel = ETHSpriteDensityManager::HD;
return hdVersionFileName;
}
}
densityLevel = ETHSpriteDensityManager::DEFAULT;
return fullFilePath;
}
示例2: LoadFromFile
bool ETHScene::LoadFromFile(const str_type::string& fileName)
{
Platform::FileManagerPtr fileManager = m_provider->GetFileManager();
if (!fileManager->FileExists(fileName))
{
ETH_STREAM_DECL(ss) << GS_L("ETHScene::Open: file not found (") << fileName << GS_L(")");
m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
return false;
}
m_minSceneHeight = 0.0f;
m_maxSceneHeight = m_provider->GetVideo()->GetScreenSizeF().y;
// Read the header and check if the file is valid
TiXmlDocument doc(fileName);
str_type::string content;
fileManager->GetUTF16FileString(fileName, content);
if (!doc.LoadFile(content, TIXML_ENCODING_LEGACY))
{
ETH_STREAM_DECL(ss) << GS_L("ETHScene::Open: file found, but parsing failed (") << fileName << GS_L(")");
m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
return false;
}
TiXmlHandle hDoc(&doc);
TiXmlHandle hRoot(0);
TiXmlElement *pElement = hDoc.FirstChildElement().Element();
if (!pElement)
{
ETH_STREAM_DECL(ss) << GS_L("ETHScene::Open: couldn't find root element (") << fileName << GS_L(")");
m_provider->Log(ss.str(), Platform::FileLogger::ERROR);
return false;
}
return ReadFromXMLFile(pElement);
}