Question

I am using KDevelop 4.3.1 with Debian Wheezy. My problem is, that for every file in my project directory KDevelop seems to create a backup file with the same name, ending with a tilde. This makes the project directorys look really unclear.

My question is if there is an option to hide these backup files (e.g. all files ending with a ~) in KDevelop? Meaning in the sidebar list of project files.

Was it helpful?

Solution

The backup files are created on save by the text editor component "Kate Part". To get rid of the *~ files, you have two options.

First, open the editor settings dialog through Settings > Configure Editor and then choose the Open/Save item, and then the Advanced tab.

  1. Disable backups

    To disable backups entirely, remove the checkbox for [ ] Local files.

  2. Hide the backup files

    To hide backups, just add the Prefix: ., so that every backup file is a hidden file. A backup file is then named e.g. .MyFile.cpp~.

The idea behind the backup files is to have the old version around in case the saved file is corrupted for whatever reason (system crash, file system error, ...?). In practice, you most probably do not need backups at all for the following reason:

When saving files, Kate uses the class KSaveFile (in Qt5 available as QSaveFile). In short, to avoid data loss, KSaveFile saves the file to a temporary file in the same directory as the target file, and on successful write finally moves the temporary file to the target filename.

In other words, saving files is pretty save and in theory should always work due to the atomic rename thanks to KSaveFile.

So the only use case for backup files are that you changed and saved a file by accident. In this case, the backup file still contains the old data provided you did not save twice.

Even more so: If you use a version control system (git, svn, ...), the usefulness of having backups is close to zero. That's also the reason why backups are disabled entirely in newer versions of the editor component.

OTHER TIPS

If you use this filter (in the top of the file list):

[A-Z]*[A-Z]

You may only see files starting and ending with a letter so no hidden files (starting with a '.') and no backup files (ending with a '~') will be shown.

Be careful as any other file not starting or ending with a letter will also be hidden

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top