Fixed - Windows, launcher use a uppercase D:\ , if you try to start your project from VS/Shortcut and use a lowercase d:\ it would ruin your project as it assign new asset IDs without remapping.

This commit is contained in:
Preben Eriksen
2022-09-24 13:46:55 +02:00
parent 76a66cf400
commit 7cae9b4ce5

View File

@@ -379,8 +379,27 @@ void AssetsCache::RegisterAssets(FlaxStorage* storage)
// Check if storage contains ID which has been already registered
if (FindAsset(e.ID, info))
{
#if PLATFORM_WINDOWS
//PE: Windows - if you start your project using a shortcut/VS commandline -project , and using a upper/lower drive letter, it could ruin your scene.
//PE: On windows case do not matter so...
if (storagePath.ToLower() != info.Path.ToLower())
{
LOG(Warning, "Founded duplicated asset \'{0}\'. Locations: \'{1}\' and \'{2}\'", e.ID, storagePath, info.Path);
duplicatedEntries.Add(i);
}
else
{
//PE: Remove from _registry so we can add it again later with the original ID, so we dont loose relations.
for (auto i = _registry.Begin(); i.IsNotEnd(); ++i)
{
if (i->Value.Info.Path.ToLower() == storagePath.ToLower())
_registry.Remove(i);
}
}
#else
LOG(Warning, "Founded duplicated asset \'{0}\'. Locations: \'{1}\' and \'{2}\'", e.ID, storagePath, info.Path);
duplicatedEntries.Add(i);
#endif
}
}