mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 21:07:42 +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:
@@ -466,9 +466,8 @@ bool PAKRouter<BRIDGETYPE>::extractResources(const BRIDGETYPE& pakBridge, bool f
|
||||
if (force || cooked.isNone()) {
|
||||
cooked.makeDirChain(false);
|
||||
PAKEntryReadStream s = entryPtr->beginReadStream(*node);
|
||||
FILE* fout = hecl::Fopen(cooked.getAbsolutePath().data(), _SYS_STR("wb"));
|
||||
fwrite(s.data(), 1, s.length(), fout);
|
||||
fclose(fout);
|
||||
const auto fout = hecl::FopenUnique(cooked.getAbsolutePath().data(), _SYS_STR("wb"));
|
||||
std::fwrite(s.data(), 1, s.length(), fout.get());
|
||||
}
|
||||
|
||||
if (extractor.func_a) /* Doesn't need PAKRouter access */
|
||||
|
||||
Reference in New Issue
Block a user