restoreAll method

void restoreAll()

Restores all backed-up files and deletes the backup directory.

Implementation

void restoreAll() {
  try {
    if (!FileUtils.exists(backupDirPath)) return;

    final manifest = _loadManifest();
    for (final entry in manifest.entries) {
      final relativePath = entry.key;
      final backupFileName = entry.value;

      final originalPath = PathUtils.join(projectRoot, relativePath);
      final backupFilePath = PathUtils.join(backupDirPath, backupFileName);

      if (FileUtils.exists(backupFilePath)) {
        FileUtils.copy(backupFilePath, originalPath);
      }
    }

    // Cleanup backup folder
    FileUtils.deleteDirectory(backupDirPath);
  } catch (e) {
    throw DeepLinkException('Failed to restore files from backup', e);
  }
}