[*] Amend FileStream::Close (232a136b)

This commit is contained in:
Reece Wilson 2024-03-27 15:40:13 +00:00
parent ec44cc1d69
commit 263ca6e646
2 changed files with 10 additions and 7 deletions

View File

@ -397,7 +397,6 @@ namespace Aurora::IO::FS
bool bDeleteFailed {};
AuString path;
if ((hHandle != INVALID_HANDLE_VALUE) &&
(this->bShouldDelete))
{

View File

@ -255,18 +255,22 @@ namespace Aurora::IO::FS
void PosixFileStream::Close()
{
AU_DEBUG_MEMCRUNCH;
AU_LOCK_GUARD(this->mutex_);
AuString path;
if (AuExchange(this->bMadeTemporary, false) &&
this->pHandle_)
{
path = this->pHandle_->GetPath();
}
auto pHandle = this->pHandle_;
AuResetMember(this->pHandle_);
if (AuExchange(this->bMadeTemporary, false))
if (path.size())
{
Aurora::RuntimeWaitForSecondaryTick();
if (pHandle)
{
PosixUnlink(pHandle->GetPath().c_str());
}
PosixUnlink(path.c_str());
}
}