- file system error management refactoring.

This commit is contained in:
Christoph Oelckers 2023-08-18 20:34:12 +02:00
commit 1dc47f91c2
19 changed files with 288 additions and 152 deletions

View file

@ -250,10 +250,13 @@ int FDirectoryLump::FillCache()
Cache = new char[LumpSize];
if (!fr.OpenFile(mFullPath))
{
memset(Cache, 0, LumpSize);
return 0;
throw FileSystemException("unable to open file");
}
auto read = fr.Read(Cache, LumpSize);
if (read != LumpSize)
{
throw FileSystemException("only read %d of %d bytes", (int)read, (int)LumpSize);
}
fr.Read(Cache, LumpSize);
RefCount = 1;
return 1;
}