Skip to content

Commit

Permalink
also include temporary files from WAL SQLite mode into debug archive
Browse files Browse the repository at this point in the history
should make sure that the debug archive has a correct up to date view of
the sync client database

Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien authored and claucambra committed Sep 24, 2024
1 parent 4254884 commit 835a1ef
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/gui/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,24 @@ ZipEntry fileInfoToLogZipEntry(const QFileInfo &info)
return entry;
}

ZipEntry syncFolderToZipEntry(OCC::Folder *f)
QVector<ZipEntry> syncFolderToDatabaseZipEntry(OCC::Folder *f)
{
QVector<ZipEntry> result;

const auto journalPath = f->journalDb()->databaseFilePath();
const auto journalInfo = QFileInfo(journalPath);
return fileInfoToZipEntry(journalInfo);
const auto walJournalInfo = QFileInfo(journalPath + "-wal");
const auto shmJournalInfo = QFileInfo(journalPath + "-shm");

result += fileInfoToZipEntry(journalInfo);
if (walJournalInfo.exists()) {
result += fileInfoToZipEntry(walJournalInfo);
}
if (shmJournalInfo.exists()) {
result += fileInfoToZipEntry(shmJournalInfo);
}

return result;
}

QVector<ZipEntry> createDebugArchiveFileList()
Expand All @@ -94,9 +107,11 @@ QVector<ZipEntry> createDebugArchiveFileList()
}

const auto folders = OCC::FolderMan::instance()->map().values();
std::transform(std::cbegin(folders), std::cend(folders),
std::back_inserter(list),
syncFolderToZipEntry);
std::for_each(std::cbegin(folders), std::cend(folders),
[&list] (auto &folderIt) {
const auto &newEntries = syncFolderToDatabaseZipEntry(folderIt);
std::copy(std::cbegin(newEntries), std::cend(newEntries), std::back_inserter(list));
});

return list;
}
Expand Down

0 comments on commit 835a1ef

Please sign in to comment.