Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KDevelop: Hide backup files

Tags:

kdevelop

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.

like image 743
Haatschii Avatar asked Dec 20 '25 13:12

Haatschii


1 Answers

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.

like image 132
dhaumann Avatar answered Dec 24 '25 07:12

dhaumann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!