fix for when file open is successful but the path isn't a file (#220)

FSC and indirectly coreinit relies on FileStream open failing for directories
This commit is contained in:
goeiecool9999 2022-09-09 16:10:12 +02:00 committed by GitHub
parent 76313fc238
commit 045a059742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,6 +198,11 @@ FileStream::FileStream(const fs::path& path, bool isOpen, bool isWriteable)
m_fileStream.open(path, std::ios_base::in | std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
m_isValid = m_fileStream.is_open();
}
if(m_isValid && fs::is_directory(path))
{
m_isValid = false;
m_fileStream.close();
}
}
void FileStream::SyncReadWriteSeek(bool nextOpIsWrite)