Fix content storage usage with relative paths

#1966
This commit is contained in:
Wojtek Figat
2023-11-23 17:37:55 +01:00
parent d99a92fd13
commit d5075d845c
4 changed files with 38 additions and 15 deletions

View File

@@ -449,18 +449,19 @@ Asset* Content::LoadAsync(const StringView& path, const ScriptingTypeHandle& typ
{
// Ensure path is in a valid format
String pathNorm(path);
StringUtils::PathRemoveRelativeParts(pathNorm);
ContentStorageManager::FormatPath(pathNorm);
const StringView filePath = pathNorm;
#if USE_EDITOR
if (!FileSystem::FileExists(pathNorm))
if (!FileSystem::FileExists(filePath))
{
LOG(Error, "Missing file \'{0}\'", pathNorm);
LOG(Error, "Missing file \'{0}\'", filePath);
return nullptr;
}
#endif
AssetInfo assetInfo;
if (GetAssetInfo(pathNorm, assetInfo))
if (GetAssetInfo(filePath, assetInfo))
{
return LoadAsync(assetInfo.ID, type);
}