Fix asset path used in registry

#394
This commit is contained in:
Wojtek Figat
2021-03-26 22:24:44 +01:00
parent 97fd733c3e
commit ebf2b0a2f3

View File

@@ -408,16 +408,20 @@ Asset* Content::LoadAsync(const StringView& path, MClass* type)
Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& type) Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& type)
{ {
// Ensure path is in a valid format
String pathNorm(path);
FileSystem::NormalizePath(pathNorm);
#if USE_EDITOR #if USE_EDITOR
if (!FileSystem::FileExists(path)) if (!FileSystem::FileExists(pathNorm))
{ {
LOG(Error, "Missing file \'{0}\'", path); LOG(Error, "Missing file \'{0}\'", pathNorm);
return nullptr; return nullptr;
} }
#endif #endif
AssetInfo assetInfo; AssetInfo assetInfo;
if (GetAssetInfo(path, assetInfo)) if (GetAssetInfo(pathNorm, assetInfo))
{ {
return LoadAsync(assetInfo.ID, type); return LoadAsync(assetInfo.ID, type);
} }