Skip to content

Commit

Permalink
Merge pull request dolphin-emu#5911 from leoetlino/windows-files
Browse files Browse the repository at this point in the history
BTBase: Fix a file deletion issue on Windows
  • Loading branch information
leoetlino authored Aug 10, 2017
2 parents 942edf5 + 71f403d commit f2a9ad0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Source/Core/Core/IOS/USB/Bluetooth/BTBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ void BackUpBTInfoSection(const SysConf* sysconf)
void RestoreBTInfoSection(SysConf* sysconf)
{
const std::string filename = File::GetUserPath(D_CONFIG_IDX) + DIR_SEP WII_BTDINF_BACKUP;
File::IOFile backup(filename, "rb");
if (!backup)
return;
auto& section = sysconf->GetOrAddEntry("BT.DINF", SysConf::Entry::Type::BigArray)->bytes;
if (!backup.ReadBytes(section.data(), section.size()))
{
ERROR_LOG(IOS_WIIMOTE, "Failed to read backed up BT.DINF section");
return;
File::IOFile backup(filename, "rb");
if (!backup)
return;
auto& section = sysconf->GetOrAddEntry("BT.DINF", SysConf::Entry::Type::BigArray)->bytes;
if (!backup.ReadBytes(section.data(), section.size()))
{
ERROR_LOG(IOS_WIIMOTE, "Failed to read backed up BT.DINF section");
return;
}
}

File::Delete(filename);
Expand Down

0 comments on commit f2a9ad0

Please sign in to comment.