mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 13:09:42 +00:00
Use VFS::Path::Normalized for fx::Technique file path
This commit is contained in:
parent
ffbeb5ab98
commit
cc35df9409
2 changed files with 22 additions and 14 deletions
|
@ -37,11 +37,22 @@ namespace
|
|||
|
||||
namespace fx
|
||||
{
|
||||
namespace
|
||||
{
|
||||
VFS::Path::Normalized makeFilePath(std::string_view name)
|
||||
{
|
||||
std::string fileName(name);
|
||||
fileName += Technique::sExt;
|
||||
VFS::Path::Normalized result(Technique::sSubdir);
|
||||
result /= fileName;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Technique::Technique(const VFS::Manager& vfs, Resource::ImageManager& imageManager, std::string name, int width,
|
||||
int height, bool ubo, bool supportsNormals)
|
||||
: mName(std::move(name))
|
||||
, mFileName(Files::pathToUnicodeString(
|
||||
(Files::pathFromUnicodeString(Technique::sSubdir) / (mName + Technique::sExt))))
|
||||
, mFilePath(makeFilePath(mName))
|
||||
, mLastModificationTime(std::filesystem::file_time_type::clock::now())
|
||||
, mWidth(width)
|
||||
, mHeight(height)
|
||||
|
@ -98,9 +109,9 @@ namespace fx
|
|||
{
|
||||
clear();
|
||||
|
||||
if (!mVFS.exists(mFileName))
|
||||
if (!mVFS.exists(mFilePath))
|
||||
{
|
||||
Log(Debug::Error) << "Could not load technique, file does not exist '" << mFileName << "'";
|
||||
Log(Debug::Error) << "Could not load technique, file does not exist '" << mFilePath << "'";
|
||||
|
||||
mStatus = Status::File_Not_exists;
|
||||
return false;
|
||||
|
@ -167,7 +178,7 @@ namespace fx
|
|||
mStatus = Status::Parse_Error;
|
||||
|
||||
mLastError = "Failed parsing technique '" + getName() + "' " + e.what();
|
||||
;
|
||||
|
||||
Log(Debug::Error) << mLastError;
|
||||
}
|
||||
|
||||
|
@ -179,11 +190,6 @@ namespace fx
|
|||
return mName;
|
||||
}
|
||||
|
||||
std::string Technique::getFileName() const
|
||||
{
|
||||
return mFileName;
|
||||
}
|
||||
|
||||
bool Technique::setLastModificationTime(std::filesystem::file_time_type timeStamp)
|
||||
{
|
||||
const bool isDirty = timeStamp != mLastModificationTime;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <osg/StateSet>
|
||||
#include <osg/Texture2D>
|
||||
|
||||
#include <components/vfs/pathutil.hpp>
|
||||
|
||||
#include "lexer.hpp"
|
||||
#include "pass.hpp"
|
||||
#include "types.hpp"
|
||||
|
@ -103,8 +105,8 @@ namespace fx
|
|||
using UniformMap = std::vector<std::shared_ptr<Types::UniformBase>>;
|
||||
using RenderTargetMap = std::unordered_map<std::string_view, Types::RenderTarget>;
|
||||
|
||||
inline static std::string sExt = ".omwfx";
|
||||
inline static std::string sSubdir = "shaders";
|
||||
static constexpr std::string_view sExt = ".omwfx";
|
||||
static constexpr std::string_view sSubdir = "shaders";
|
||||
|
||||
enum class Status
|
||||
{
|
||||
|
@ -128,7 +130,7 @@ namespace fx
|
|||
|
||||
std::string getName() const;
|
||||
|
||||
std::string getFileName() const;
|
||||
const VFS::Path::Normalized& getFileName() const { return mFilePath; }
|
||||
|
||||
bool setLastModificationTime(std::filesystem::file_time_type timeStamp);
|
||||
|
||||
|
@ -251,7 +253,7 @@ namespace fx
|
|||
|
||||
std::string mShared;
|
||||
std::string mName;
|
||||
std::string mFileName;
|
||||
VFS::Path::Normalized mFilePath;
|
||||
std::string_view mBlockName;
|
||||
std::string_view mAuthor;
|
||||
std::string_view mDescription;
|
||||
|
|
Loading…
Reference in a new issue