backupFile function
Provide a very simple mechanism to backup a single file.
The backup is placed in '.bak' subdirectory under the passed
pathToFile's directory.
Be cautious that you don't nest backups of the same file in your code as we always use the same backup target. Instead use withFileProtectionAsync.
We also renamed the backup to <filename>.bak to ensure
the backupfile doesn't interfere with dev tools
(e.g. we don't want an extra pubspec.yaml hanging about)
If a file at pathToFile doesn't exist then a BackupFileException
is thrown unless you pass the ignoreMissing flag.
See:
@Throwing(ArgumentError) @Throwing(BackupFileException) @Throwing(CopyException) @Throwing(CreateDirException) @Throwing(DeleteException)
Implementation
void backupFile(String pathToFile, {bool ignoreMissing = false}) =>
core.backupFile(pathToFile, ignoreMissing: ignoreMissing);