From 7cae9b4ce5aa2116826bfded9a8f139aeb58d9e6 Mon Sep 17 00:00:00 2001 From: Preben Eriksen Date: Sat, 24 Sep 2022 13:46:55 +0200 Subject: [PATCH] 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. --- Source/Engine/Content/Cache/AssetsCache.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/Engine/Content/Cache/AssetsCache.cpp b/Source/Engine/Content/Cache/AssetsCache.cpp index 459a9f31f..44461a68b 100644 --- a/Source/Engine/Content/Cache/AssetsCache.cpp +++ b/Source/Engine/Content/Cache/AssetsCache.cpp @@ -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 } }