Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
user_data_backup.cpp File Reference
#include "user_data_backup.h"
#include <QDateTime>
#include <QDir>
#include <QDirIterator>
#include <QFile>
#include <QFileInfo>
#include <QStandardPaths>
Include dependency graph for user_data_backup.cpp:

Namespaces

namespace  UserDataBackup

Functions

bool UserDataBackup::copyDirectoryRecursively (const QString &sourceDir, const QString &destDir)
 Recursively copies sourceDir into destDir, creating it as needed.
bool UserDataBackup::createBackupSessionDir (const QString &backupRoot, QString *sessionDirOut)
 Creates a fresh timestamped session directory under backupRoot.
bool UserDataBackup::backupAtRiskPaths (const QStringList &sourcePaths, const QString &backupRoot, QStringList *backupLocationsOut, QString *sessionDirOut=nullptr)
 Copies several at-risk paths into a single timestamped session directory.
qint64 UserDataBackup::estimateBackupSize (const QStringList &sourcePaths, qint64 capBytes=MAX_AUTO_BACKUP_BYTES)
 Estimates the total bytes that backing up sourcePaths would copy.
QString UserDataBackup::defaultBackupRoot ()
 Default backup root guaranteed to live outside the install directory.
QStringList UserDataBackup::listBackupSessions (const QString &backupRoot)
 Lists existing backup session directories under backupRoot, newest first.
QString UserDataBackup::findRecentCoveringBackupSession (const QString &backupRoot, const QStringList &sourcePaths, int maxAgeHours=24)
 Returns the newest non-empty session covering sourcePaths, regardless of completeness.
QString UserDataBackup::findRecentUsableBackupSession (const QString &backupRoot, const QStringList &sourcePaths, int maxAgeHours=24)
 Returns the newest session that is non-empty, complete and covering sourcePaths, or empty.
bool UserDataBackup::isBackupSessionComplete (const QString &sessionDir)
 Reports whether sessionDir holds a complete backup.
void UserDataBackup::pruneOldBackupSessions (const QString &backupRoot, int keepCount=5)
 Deletes oldest sessions keeping only the newest keepCount ones. Empty sessions are junk from failed attempts and are always removed, so they can never evict a good session from the kept set.
QStringList UserDataBackup::listSessionBackupLocations (const QString &sessionDir)
 Lists the backup targets inside an existing session directory.
bool UserDataBackup::sessionCoversSources (const QString &sessionDir, const QStringList &sourcePaths)
 Reports whether sessionDir was recorded as covering all of sourcePaths.