mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-29 22:42:40 +02:00
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:
parent
9ca1336762
commit
5ba19935cb
@ -21,6 +21,7 @@
|
||||
namespace ams::erpt::srv {
|
||||
|
||||
constexpr inline const char ReportOnSdStoragePath[] = "ersd";
|
||||
constexpr inline const char ReportOnSdStorageRootDirectoryPath[] = "ersd:/";
|
||||
|
||||
constexpr inline const char ReportStoragePath[] = "save";
|
||||
constexpr inline const char JournalFileName[] = "save:/journal";
|
||||
|
@ -88,7 +88,7 @@ namespace ams::erpt::srv {
|
||||
s64 report_count = MinimumReportCountForCleanup;
|
||||
|
||||
fs::DirectoryHandle dir;
|
||||
if (R_SUCCEEDED(fs::OpenDirectory(std::addressof(dir), ReportOnSdStoragePath, fs::OpenDirectoryMode_All))) {
|
||||
if (R_SUCCEEDED(fs::OpenDirectory(std::addressof(dir), ReportOnSdStorageRootDirectoryPath, fs::OpenDirectoryMode_All))) {
|
||||
ON_SCOPE_EXIT { fs::CloseDirectory(dir); };
|
||||
|
||||
if (R_FAILED(fs::GetDirectoryEntryCount(std::addressof(report_count), dir))) {
|
||||
@ -97,7 +97,7 @@ namespace ams::erpt::srv {
|
||||
}
|
||||
|
||||
if (report_count >= MinimumReportCountForCleanup) {
|
||||
fs::CleanDirectoryRecursively(ReportOnSdStoragePath);
|
||||
fs::CleanDirectoryRecursively(ReportOnSdStorageRootDirectoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user