Fix build tool crash when includes cache file is corrupted

This commit is contained in:
Wojtek Figat
2023-04-03 23:42:32 +02:00
parent 820c18968a
commit eda07ac57b

View File

@@ -26,6 +26,8 @@ namespace Flax.Build.NativeCpp
if (!File.Exists(CachePath))
return;
try
{
using (var stream = new FileStream(CachePath, FileMode.Open))
using (var reader = new BinaryReader(stream))
{
@@ -84,6 +86,15 @@ namespace Flax.Build.NativeCpp
}
}
}
catch (Exception)
{
// Clear cache in case of error when loading data (eg. corrupted file)
DirectIncludesCache.Clear();
AllIncludesCache.Clear();
DirectIncludesTimestampCache.Clear();
AllIncludesTimestampCache.Clear();
}
}
public static void SaveCache()
{