File Buffer Basics
File Buffer Basics
A file buffer is the temporary image of a file that you can edit in a source file window. All edits are recorded in this temporary file buffer until a file is saved.
The File > Save command writes the file buffer contents back over the original file. This is the only time the original file is changed.
Figure 3.17 Open and Save operations.
Backup Files
Source Insight makes a backup copy of a file the first time you save the file after opening it. If you open a file and save it ten times, you will still only get one backup file. If you close and reopen file, or start a new Source
Insight session, a new backup will be saved when you save the file again.
Opening a Backup File
To open a backup version of the current file, select File > Open Backup File. See “Open Backup File” on page 259.
Saving a New Backup File
Normally you don’t need to save your own backup files because they get created automatically when you save files. However you can use the Save New Backup File command to take a snapshot of the current file buffer and save it as a new backup file. The new backup is added to the existing backup files in the Backup folder.
To open a backup version of the current file, select File > Open Backup File. See “Open Backup File” on page 259.
Backup Folder Location
Backup files are stored in the Backup folder of the current project. You can edit the Backup folder location by using Project > Project Settings.
Backup File Names
Backup files are given a unique name based on the original file name. For example if the original file name is render.c
, then the backup name will be something like render(1066).c
where the
(1066)
part is a random value to make the file name unique in the Backup directory.
Source Insight 4 User Guide 123
File Buffer Basics
Comparing a File with a Backup Version
To compare the current file with a backup version of the same file, select Tools > Compare With Backup File.
See “Compare with Backup File” on page 170.
Backup Options
You can set options for backup files by selecting Options > Preferences: Files. See “File Options” on page 202.
The following options control backup files:
Checkpointing Files
The File > Checkpoint command saves the current file to disk and erases its change history and undo history.
You can think of this as a "clean" save operation. It has the same effect as saving the file, closing it, and opening it again.
After using Checkpoint, you will not be able to undo any prior changes. Checkpoint also re-arms the file backup feature so that when you save it again, a new backup file is made.
Reloading and Restoring Files
To reload a file, use the Reload File command. This loads the file from disk again, losing all undo information.
It’s exactly like closing the file, then opening it again. You cannot use Undo to undo any prior changes.
To restore a file to its original state when you first opened it, use the Restore File command. This loses all changes you made since you first opened it. It does not reload the file from disk. It returns the file to the way it looked when you first opened it. You can use Undo to undo the Restore File operation.
To open an older version of your file, use the File > Open Backup File command to pick a backup file and load it. The backup file will open in a new source file window and won’t alter the current file.
Time stamping
Source Insight records each source file's signature in the project database. The signature is composed of the file’s modification date, plus the file’s size. If you open a source file later and the file's signature differs from what is in the project database, then Source Insight will re-synchronize the project symbol database for that file. By automatically synchronizing, you or others in your development team can use another text editor or a
source control system and still maintain Source Insight's project databases. See “Synchronize Files” on page 342.
124 Source Insight 4 User Guide