mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Change normalizeFilename signature
This commit is contained in:
parent
d4e26746a3
commit
c2df0949e2
11 changed files with 21 additions and 49 deletions
|
@ -66,13 +66,10 @@ namespace MWGui
|
|||
|
||||
void LoadingScreen::findSplashScreens()
|
||||
{
|
||||
std::string pattern = "Splash/";
|
||||
mResourceSystem->getVFS()->normalizeFilename(pattern);
|
||||
|
||||
/* priority given to the left */
|
||||
const std::array<std::string, 7> supported_extensions {{".tga", ".dds", ".ktx", ".png", ".bmp", ".jpeg", ".jpg"}};
|
||||
|
||||
for (const auto& name : mResourceSystem->getVFS()->getRecursiveDirectoryIterator(pattern))
|
||||
for (const auto& name : mResourceSystem->getVFS()->getRecursiveDirectoryIterator("Splash/"))
|
||||
{
|
||||
size_t pos = name.find_last_of('.');
|
||||
if (pos != std::string::npos)
|
||||
|
|
|
@ -598,8 +598,6 @@ namespace MWRender
|
|||
}
|
||||
animationPath.replace(animationPath.size()-3, 3, "/");
|
||||
|
||||
mResourceSystem->getVFS()->normalizeFilename(animationPath);
|
||||
|
||||
for (const auto& name : mResourceSystem->getVFS()->getRecursiveDirectoryIterator(animationPath))
|
||||
{
|
||||
size_t pos = name.find_last_of('.');
|
||||
|
@ -1292,8 +1290,6 @@ namespace MWRender
|
|||
}
|
||||
animationPath.replace(animationPath.size()-4, 4, "/");
|
||||
|
||||
resourceSystem->getVFS()->normalizeFilename(animationPath);
|
||||
|
||||
for (const auto& name : resourceSystem->getVFS()->getRecursiveDirectoryIterator(animationPath))
|
||||
{
|
||||
size_t pos = name.find_last_of('.');
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace MWSound
|
|||
max = std::max(min, max);
|
||||
|
||||
Sound_Buffer& sfx = mSoundBuffers.emplace_back("Sound/" + sound.mSound, volume, min, max);
|
||||
mVfs->normalizeFilename(sfx.mResourceName);
|
||||
sfx.mResourceName = mVfs->normalizeFilename(sfx.mResourceName);
|
||||
|
||||
mBufferNameMap.emplace(soundId, &sfx);
|
||||
return &sfx;
|
||||
|
|
|
@ -295,10 +295,7 @@ namespace MWSound
|
|||
{
|
||||
std::vector<std::string> filelist;
|
||||
|
||||
std::string pattern = "Music/" + playlist;
|
||||
mVFS->normalizeFilename(pattern);
|
||||
|
||||
for (const auto& name : mVFS->getRecursiveDirectoryIterator(pattern))
|
||||
for (const auto& name : mVFS->getRecursiveDirectoryIterator("Music/" + playlist))
|
||||
filelist.push_back(name);
|
||||
|
||||
mMusicFiles[playlist] = filelist;
|
||||
|
@ -345,10 +342,7 @@ namespace MWSound
|
|||
if(!mOutput->isInitialized())
|
||||
return;
|
||||
|
||||
std::string voicefile = "Sound/"+filename;
|
||||
|
||||
mVFS->normalizeFilename(voicefile);
|
||||
DecoderPtr decoder = loadVoice(voicefile);
|
||||
DecoderPtr decoder = loadVoice(mVFS->normalizeFilename("Sound/" + filename));
|
||||
if (!decoder)
|
||||
return;
|
||||
|
||||
|
@ -379,10 +373,7 @@ namespace MWSound
|
|||
if(!mOutput->isInitialized())
|
||||
return;
|
||||
|
||||
std::string voicefile = "Sound/"+filename;
|
||||
|
||||
mVFS->normalizeFilename(voicefile);
|
||||
DecoderPtr decoder = loadVoice(voicefile);
|
||||
DecoderPtr decoder = loadVoice(mVFS->normalizeFilename("Sound/" + filename));
|
||||
if (!decoder)
|
||||
return;
|
||||
|
||||
|
|
|
@ -191,10 +191,7 @@ namespace Gui
|
|||
|
||||
void FontLoader::loadBitmapFonts(bool exportToFile)
|
||||
{
|
||||
std::string pattern = "Fonts/";
|
||||
mVFS->normalizeFilename(pattern);
|
||||
|
||||
for (const auto& name : mVFS->getRecursiveDirectoryIterator(pattern))
|
||||
for (const auto& name : mVFS->getRecursiveDirectoryIterator("Fonts/"))
|
||||
{
|
||||
size_t pos = name.find_last_of('.');
|
||||
if (pos != std::string::npos && name.compare(pos, name.size() - pos, ".fnt") == 0)
|
||||
|
|
|
@ -121,8 +121,7 @@ BulletShapeManager::~BulletShapeManager()
|
|||
|
||||
osg::ref_ptr<const BulletShape> BulletShapeManager::getShape(const std::string &name)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<BulletShape> shape;
|
||||
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
||||
|
@ -180,8 +179,7 @@ osg::ref_ptr<const BulletShape> BulletShapeManager::getShape(const std::string &
|
|||
|
||||
osg::ref_ptr<BulletShapeInstance> BulletShapeManager::cacheInstance(const std::string &name)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<BulletShapeInstance> instance = createInstance(normalized);
|
||||
if (instance)
|
||||
|
@ -191,8 +189,7 @@ osg::ref_ptr<BulletShapeInstance> BulletShapeManager::cacheInstance(const std::s
|
|||
|
||||
osg::ref_ptr<BulletShapeInstance> BulletShapeManager::getInstance(const std::string &name)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<osg::Object> obj = mInstanceCache->takeFromObjectCache(normalized);
|
||||
if (obj.get())
|
||||
|
|
|
@ -83,8 +83,7 @@ namespace Resource
|
|||
|
||||
osg::ref_ptr<osg::Image> ImageManager::getImage(const std::string &filename)
|
||||
{
|
||||
std::string normalized = filename;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(filename);
|
||||
|
||||
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
||||
if (obj)
|
||||
|
|
|
@ -133,8 +133,7 @@ namespace Resource
|
|||
|
||||
osg::ref_ptr<const SceneUtil::KeyframeHolder> KeyframeManager::get(const std::string &name)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
||||
if (obj)
|
||||
|
|
|
@ -358,10 +358,7 @@ namespace Resource
|
|||
|
||||
bool SceneManager::checkLoaded(const std::string &name, double timeStamp)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
|
||||
return mCache->checkInObjectCache(normalized, timeStamp);
|
||||
return mCache->checkInObjectCache(mVFS->normalizeFilename(name), timeStamp);
|
||||
}
|
||||
|
||||
/// @brief Callback to read image files from the VFS.
|
||||
|
@ -533,8 +530,7 @@ namespace Resource
|
|||
|
||||
osg::ref_ptr<const osg::Node> SceneManager::getTemplate(const std::string &name, bool compile)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<osg::Object> obj = mCache->getRefFromObjectCache(normalized);
|
||||
if (obj)
|
||||
|
@ -603,8 +599,7 @@ namespace Resource
|
|||
|
||||
osg::ref_ptr<osg::Node> SceneManager::cacheInstance(const std::string &name)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<osg::Node> node = createInstance(normalized);
|
||||
|
||||
|
@ -642,8 +637,7 @@ namespace Resource
|
|||
|
||||
osg::ref_ptr<osg::Node> SceneManager::getInstance(const std::string &name)
|
||||
{
|
||||
std::string normalized = name;
|
||||
mVFS->normalizeFilename(normalized);
|
||||
const std::string normalized = mVFS->normalizeFilename(name);
|
||||
|
||||
osg::ref_ptr<osg::Object> obj = mInstanceCache->takeFromObjectCache(normalized);
|
||||
if (obj.get())
|
||||
|
|
|
@ -86,9 +86,11 @@ namespace VFS
|
|||
return mIndex.find(normalized) != mIndex.end();
|
||||
}
|
||||
|
||||
void Manager::normalizeFilename(std::string &name) const
|
||||
std::string Manager::normalizeFilename(const std::string& name) const
|
||||
{
|
||||
normalize_path(name, mStrict);
|
||||
std::string result = name;
|
||||
normalize_path(result, mStrict);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string Manager::getArchive(const std::string& name) const
|
||||
|
@ -105,6 +107,6 @@ namespace VFS
|
|||
|
||||
RecursiveDirectoryIterator Manager::getRecursiveDirectoryIterator(const std::string& path) const
|
||||
{
|
||||
return RecursiveDirectoryIterator(mIndex, path);
|
||||
return RecursiveDirectoryIterator(mIndex, normalizeFilename(path));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace VFS
|
|||
|
||||
/// Normalize the given filename, making slashes/backslashes consistent, and lower-casing if mStrict is false.
|
||||
/// @note May be called from any thread once the index has been built.
|
||||
void normalizeFilename(std::string& name) const;
|
||||
[[nodiscard]] std::string normalizeFilename(const std::string& name) const;
|
||||
|
||||
/// Retrieve a file by name.
|
||||
/// @note Throws an exception if the file can not be found.
|
||||
|
|
Loading…
Reference in a new issue