MCPcopy Create free account
hub / github.com/OGRECave/ogre / exists

Method exists

OgreMain/src/OgreFileSystem.cpp:495–527  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

493 }
494 //-----------------------------------------------------------------------
495 bool FileSystemArchive::exists(const String& filename) const
496 {
497 if (filename.empty())
498 return false;
499
500 String full_path = concatenate_path(mName, filename);
501
502#ifdef _OGRE_FILESYSTEM_ARCHIVE_UNICODE
503 struct _stat64i32 tagStat;
504 bool ret = (_wstat(to_wpath(full_path).c_str(), &tagStat) == 0);
505#else
506 struct stat tagStat;
507 bool ret = (stat(full_path.c_str(), &tagStat) == 0);
508#endif
509
510 // stat will return true if the filename is absolute, but we need to check
511 // the file is actually in this archive
512 if (ret && is_absolute_path(filename.c_str()))
513 {
514 // only valid if full path starts with our base
515#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
516 // case insensitive on windows
517 String lowerCaseName = mName;
518 StringUtil::toLowerCase(lowerCaseName);
519 ret = Ogre::StringUtil::startsWith(full_path, lowerCaseName, true);
520#else
521 // case sensitive
522 ret = Ogre::StringUtil::startsWith(full_path, mName, false);
523#endif
524 }
525
526 return ret;
527 }
528 //---------------------------------------------------------------------
529 time_t FileSystemArchive::getModifiedTime(const String& filename) const
530 {

Callers

nothing calls this directly

Calls 5

concatenate_pathFunction · 0.85
to_wpathFunction · 0.85
is_absolute_pathFunction · 0.85
statClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected