Merge pull request #5389 from leoetlino/delete-title

IOS/ES: Fix DeleteTitle to not use CNANDContentManager
This commit is contained in:
Léo Lam 2017-05-07 17:14:04 +02:00 committed by GitHub
commit 18b1ee59ed
2 changed files with 4 additions and 5 deletions

View File

@ -239,7 +239,7 @@ void TicketReader::SetBytes(std::vector<u8>&& bytes)
bool TicketReader::IsValid() const
{
return m_bytes.size() % sizeof(Ticket) == 0;
return !m_bytes.empty() && m_bytes.size() % sizeof(Ticket) == 0;
}
void TicketReader::DoState(PointerWrap& p)

View File

@ -317,17 +317,16 @@ IPCCommandResult ES::DeleteTitle(const IOCtlVRequest& request)
return GetDefaultReply(ES_EINVAL);
const std::string title_dir = Common::GetTitlePath(title_id, Common::FROM_SESSION_ROOT);
if (!File::IsDirectory(title_dir) ||
!DiscIO::CNANDContentManager::Access().RemoveTitle(title_id, Common::FROM_SESSION_ROOT))
{
if (!File::IsDirectory(title_dir))
return GetDefaultReply(FS_ENOENT);
}
if (!File::DeleteDirRecursively(title_dir))
{
ERROR_LOG(IOS_ES, "DeleteTitle: Failed to delete title directory: %s", title_dir.c_str());
return GetDefaultReply(FS_EACCESS);
}
// XXX: ugly, but until we drop CNANDContentManager everywhere, this is going to be needed.
DiscIO::CNANDContentManager::Access().ClearCache();
return GetDefaultReply(IPC_SUCCESS);
}