mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 09:07:43 +00:00
General: Make use of FopenUnique where applicable
Migrates to the hecl Fopen variant that automatically closes its contained file handle if it goes out of scope.
This commit is contained in:
@@ -29,10 +29,10 @@ kabufuda::SystemString CMemoryCardSys::_CreateDolphinCard(kabufuda::ECardSlot sl
|
||||
return {};
|
||||
|
||||
path += fmt::format(fmt("/MemoryCard{:c}.USA.raw"), slot == kabufuda::ECardSlot::SlotA ? 'A' : 'B');
|
||||
FILE* fp = hecl::Fopen(path.c_str(), "wb");
|
||||
if (!fp)
|
||||
const auto fp = hecl::FopenUnique(path.c_str(), "wb");
|
||||
if (fp == nullptr) {
|
||||
return {};
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user