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 | number | boolean,
  overwrite: boolean
): boolean

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-written, based on Nucleus GenericContext.cs (BackupFile, both overloads), GenericGameHandler.cs (userBackedFiles restore on end). Not from the official docs. Is it wrong? Tell us

✎ Parameters: AI-written from the Nucleus source.

Handler API docs

Is this right? Tell us what's wrong
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop