1
0
forked from mirrors/0ad

Normalize module-path

Modules indipendant of the path, should only be evaluated once.
This commit is contained in:
phosit
2025-04-03 19:59:05 +02:00
committed by phosit
parent c6d42ebbd5
commit 32ef4fd0fa
4 changed files with 21 additions and 9 deletions
+2 -1
View File
@@ -58,7 +58,8 @@ namespace
[[nodiscard]] JSObject* CompileModule(const ScriptRequest& rq, ModuleLoader::RegistryType& registry,
const VfsPath& filePath)
{
const auto insertResult = registry.try_emplace(filePath, rq, filePath);
const VfsPath normalizedPath{filePath.fileSystemPath().lexically_normal().generic_string()};
const auto insertResult = registry.try_emplace(normalizedPath, rq, normalizedPath);
return std::get<1>(*std::get<0>(insertResult)).m_ModuleObject;
}