Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 981069af authored by Jonathan Nguyen's avatar Jonathan Nguyen
Browse files

Fix issue where train files would not be deleted past TTL or when over

file number limit.

Test: manual test
Change-Id: Iba6a7f7236cb37dd392ce535ff1875cd31bc9c59
parent dfa78d37
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -690,14 +690,16 @@ void StorageManager::trimToFit(const char* path, bool parseTimestampOnly) {
        if (name[0] == '.') continue;
        if (name[0] == '.') continue;


        FileName output;
        FileName output;
        string file_name;
        if (parseTimestampOnly) {
        if (parseTimestampOnly) {
            file_name = StringPrintf("%s/%s", path, name);
            output.mTimestampSec = StrToInt64(strtok(name, "_"));
            output.mTimestampSec = StrToInt64(strtok(name, "_"));
            output.mIsHistory = false;
            output.mIsHistory = false;
        } else {
        } else {
            parseFileName(name, &output);
            parseFileName(name, &output);
            file_name = output.getFullFileName(path);
        }
        }
        if (output.mTimestampSec == -1) continue;
        if (output.mTimestampSec == -1) continue;
        string file_name = output.getFullFileName(path);


        // Check for timestamp and delete if it's too old.
        // Check for timestamp and delete if it's too old.
        long fileAge = nowSec - output.mTimestampSec;
        long fileAge = nowSec - output.mTimestampSec;