erpt: fix multiple issues with automatic report cleanup (thanks @yellows8)

* Setting retrieval was performed before the call that used the setting.
* Call to detect number of files passed incomplete path and was guaranteed to fail.
* Call to delete reports passed incomplete path and was guaranteed to do nothing.
This commit is contained in:
Michael Scire
2022-12-13 01:08:13 -07:00
parent 1f8798ace7
commit 04c9004e05
3 changed files with 9 additions and 8 deletions

View File

@@ -78,12 +78,6 @@ namespace ams {
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(erpt, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(erpt, Main));
/* Set the memory heap for erpt::srv namespace. */
R_ABORT_UNLESS(erpt::srv::Initialize(erpt::g_memory_heap, erpt::MemoryHeapSize));
/* Atmosphere always wants to redirect new reports to the SD card, to prevent them from being logged. */
erpt::srv::SetRedirectNewReportsToSdCard(true);
/* Decide whether or not to clean up reports periodically. */
{
u8 disable_report_cleanup = 0;
@@ -94,6 +88,12 @@ namespace ams {
}
}
/* Set the memory heap for erpt::srv namespace, perform other service init/etc. */
R_ABORT_UNLESS(erpt::srv::Initialize(erpt::g_memory_heap, erpt::MemoryHeapSize));
/* Atmosphere always wants to redirect new reports to the SD card, to prevent them from being logged. */
erpt::srv::SetRedirectNewReportsToSdCard(true);
/* Configure the OS version. */
{
settings::system::FirmwareVersion firmware_version = {};