Fix build tool crash when includes cache file is corrupted
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user