Skip to content

Commit 17b1983

Browse files
committed
Fix bug that was causing CameraFrames folders to remain beyond the 30-day period
1 parent 8a40e75 commit 17b1983

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/logger.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,15 @@ void Logger::RemoveOldDirectories(const wxString& filePattern, int DaysOld)
188188
bool more = dir.GetFirst(&subdir, filePattern, wxDIR_DIRS);
189189
while (more)
190190
{
191-
wxString rslt = subdir.AfterFirst('_');
192-
if (rslt < oldestDateStr)
193-
dirTargets.Add(subdir);
194-
more = dir.GetNext(&subdir);
191+
// folder name example: PHD2_CameraFrames_2026-05-06-142018
192+
int start = subdir.Find("CameraFrames_");
193+
if (start != wxNOT_FOUND)
194+
{
195+
wxString rslt = subdir.Mid(start + 13);
196+
if (rslt < oldestDateStr)
197+
dirTargets.Add(subdir);
198+
more = dir.GetNext(&subdir);
199+
}
195200
}
196201
dir.Close();
197202
for (unsigned int i = 0; i < dirTargets.GetCount(); i++)

0 commit comments

Comments
 (0)