mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-11 13:06:56 +03:00
Use normalized path for correctActorModelPath
This commit is contained in:
parent
376911f645
commit
afa769408a
10 changed files with 30 additions and 25 deletions
|
@ -142,22 +142,23 @@ std::string Misc::ResourceHelpers::correctBookartPath(
|
|||
return image;
|
||||
}
|
||||
|
||||
std::string Misc::ResourceHelpers::correctActorModelPath(std::string_view resPath, const VFS::Manager* vfs)
|
||||
VFS::Path::Normalized Misc::ResourceHelpers::correctActorModelPath(
|
||||
VFS::Path::NormalizedView resPath, const VFS::Manager* vfs)
|
||||
{
|
||||
std::string mdlname(resPath);
|
||||
std::string::size_type p = mdlname.find_last_of("/\\");
|
||||
std::string mdlname(resPath.value());
|
||||
std::string::size_type p = mdlname.find_last_of('/');
|
||||
if (p != std::string::npos)
|
||||
mdlname.insert(mdlname.begin() + p + 1, 'x');
|
||||
mdlname.insert(mdlname.begin() + static_cast<std::string::difference_type>(p) + 1, 'x');
|
||||
else
|
||||
mdlname.insert(mdlname.begin(), 'x');
|
||||
std::string kfname = mdlname;
|
||||
if (Misc::StringUtils::ciEndsWith(kfname, ".nif"))
|
||||
kfname.replace(kfname.size() - 4, 4, ".kf");
|
||||
|
||||
VFS::Path::Normalized kfname(mdlname);
|
||||
if (Misc::getFileExtension(mdlname) == "nif")
|
||||
kfname.changeExtension("kf");
|
||||
|
||||
if (!vfs->exists(kfname))
|
||||
{
|
||||
return std::string(resPath);
|
||||
}
|
||||
return VFS::Path::Normalized(resPath);
|
||||
|
||||
return mdlname;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Misc
|
|||
std::string correctBookartPath(std::string_view resPath, int width, int height, const VFS::Manager* vfs);
|
||||
/// Use "xfoo.nif" instead of "foo.nif" if "xfoo.kf" is available
|
||||
/// Note that if "xfoo.nif" is actually unavailable, we can't fall back to "foo.nif". :(
|
||||
std::string correctActorModelPath(std::string_view resPath, const VFS::Manager* vfs);
|
||||
VFS::Path::Normalized correctActorModelPath(VFS::Path::NormalizedView resPath, const VFS::Manager* vfs);
|
||||
std::string correctMaterialPath(std::string_view resPath, const VFS::Manager* vfs);
|
||||
|
||||
// Adds "meshes\\".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue