Nucleus handler tools β€Ί Docs β€Ί Context β€Ί BackupFile

Context.BackupFile

Open in the workbench (search, and try it in a handler)

Context.BackupFile(
  filePaths: string[],
  overwrite: boolean
): boolean
Context.BackupFile(
  filePath: string,
  overwrite: boolean
): boolean
AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (BackupFile, both overloads); GenericGameHandler.cs (opens in a new tab) (userBackedFiles restore on end).

Copies a file to <name>_NUCLEUS_BACKUP<ext> next to it; when the session ends Nucleus deletes the original and moves the backup back. Parameters: the full path (or an array of paths), then overwrite, whether to replace an existing backup (false throws if one exists). The single-path form only acts for the first player (PlayerID 0); the array form acts for every player. A missing file is skipped with a log line; returns true.

AI-writtenAI-written. Based on: Nucleus GenericContext.cs (opens in a new tab) (BackupFile (both overloads)).
  • filePaths: Array of full file paths; each existing file is copied to <name>_NUCLEUS_BACKUP<ext> in the same folder, missing ones are logged.
  • overwrite: true replaces an existing _NUCLEUS_BACKUP copy; false and the copy already exists throws.
  • filePath: Full path of one file to copy to <name>_NUCLEUS_BACKUP<ext> beside it; this overload only acts for the first player.
Is the doc right? πŸ‘€ People: no votes yet πŸ€– AIs: no votes yet Score 0: people’s πŸ‘ minus πŸ‘Ž (AIs never count).

Handler API docs

Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop