ProjectBackup.h header

#include <ew/app/ProjectBackup.h>

Namespace ew::app

BackupResult struct

struct ew::app::BackupResult

The outcome of a project-backup attempt: the path of the backup written (empty on failure) and how many older backups were pruned to honour the retention limit.

Members

QString ew::app::BackupResult::path

The full path of the created ".ewbackup" file, or empty if the backup could not be written (for example the project folder does not exist or has no files).

int ew::app::BackupResult::pruned = 0

The number of older backups deleted to keep at most the requested count.

Functions

BackupResult ew::app::createProjectBackup(const QString &projectDir, const QString &backupsDir, const QString &projectName, const QString &timestamp, int keep)

Writes a point-in-time backup of the folder-of-text project at projectDir as a single ZIP archive named "<projectName>-<timestamp>.ewbackup" under backupsDir (created if needed), then deletes the oldest "<projectName>-*.ewbackup" files so at most keep remain. This is the crash/recovery safety net for a folder-of-text project: each backup captures the whole project tree so a corrupted or mistakenly edited project can be restored. Dotfiles and dot-folders (VCS metadata, the derived index) are skipped, and backupsDir is never backed up into itself. timestamp is supplied by the caller (e.g. "yyyyMMdd-HHmmss") so the result is deterministic and testable, and its lexical order matches chronological order so pruning keeps the newest. A keep of zero or less disables pruning. Returns the created path and the prune count; the path is empty when nothing could be backed up.