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
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.
✎ Parameters: AI-written from the Nucleus source.