Shader/FilesystemModuleResolver: Fix RegisterModuleDirectory

This commit is contained in:
Jérôme Leclercq 2022-03-15 13:20:17 +01:00
parent 0e92ef823d
commit 06406fc20e
2 changed files with 5 additions and 5 deletions

View File

@ -24,10 +24,10 @@ namespace Nz
FilesystemModuleResolver(FilesystemModuleResolver&&) = default;
~FilesystemModuleResolver() = default;
void RegisterModule(std::filesystem::path realPath);
void RegisterModule(const std::filesystem::path& realPath);
void RegisterModule(std::string_view moduleSource);
void RegisterModule(ShaderAst::ModulePtr module);
void RegisterModuleDirectory(std::filesystem::path realPath);
void RegisterModuleDirectory(const std::filesystem::path& realPath);
ShaderAst::ModulePtr Resolve(const std::string& moduleName) override;

View File

@ -11,7 +11,7 @@
namespace Nz
{
void FilesystemModuleResolver::RegisterModule(std::filesystem::path realPath)
void FilesystemModuleResolver::RegisterModule(const std::filesystem::path& realPath)
{
return RegisterModule(ShaderLang::ParseFromFile(realPath));
}
@ -32,11 +32,11 @@ namespace Nz
m_modules.emplace(std::move(moduleName), std::move(module));
}
void FilesystemModuleResolver::RegisterModuleDirectory(std::filesystem::path realPath)
void FilesystemModuleResolver::RegisterModuleDirectory(const std::filesystem::path& realPath)
{
for (const auto& entry : std::filesystem::recursive_directory_iterator(realPath))
{
if (entry.is_regular_file() && StringEqual(entry.path().extension().generic_u8string(), "nzsl", Nz::CaseIndependent{}))
if (entry.is_regular_file() && StringEqual(entry.path().extension().generic_u8string(), ".nzsl", Nz::CaseIndependent{}))
{
try
{