Forum > Options

[SOLVED] Better customization of target for backups?

(1/2) > >>

Eugene Loza:
There are many options to choose from on where and how to make backups of the project files. However, it doesn't seem flexible enough for me. I wonder, maybe I'm missing something?

The problem I'm having is: I have 244 units in my project, all located in "code" subfolder, with multiple subfolders inside. Sometimes it's faster for me to "grep" (use an external tool to search for) a keyword inside, e.g. to know all places where this specific variable/field/method is referenced.

However, as "backup" folder is dropped in every subfolder... I get double results for files I've edited with one version of the file even being obsolete and causing confusion (I'm 100% sure I removed the reference, but I still get it in grep result, open the file and see the old code, takes a few dozens of seconds to figure out it's in backup folder), requiring me to use a script to delete all backup folders from the project, which while not too bad, but is "extra step" that I'd like to avoid.

So, I wonder, if there an alternative to completely disabling "backup" feature? I mean using version control system I can't remember a single time in the last 5 years that I needed to recover a file from backup, so it's not a big loss, but still a loss :)

So what I'd like to do is to have backups in some "predefined" folder, outside of where the code files are, maybe structured/organized in a similar tree to avoid potential filenames conflict (which isn't my case, but I understand that some users might do weird things that aren't strictly forbidden :)). I wonder if it's possible?

Using grep  --exclude-dir=backup <other options>, maybe?
Grep will skip directories who's name start with backup.
This can be configured inside Lazarus, I believe.

Completely disabling backup is not recommended.

grep --exclude-dir=backup -nHIirFw -- <word to find >

I indicated one of the options in this issue. In it I provided a method for automatically creating a commit after compiling a project. I don't know if this is suitable for large projects.

But you can specify any script. For example, which simply makes a copy of only some files (*.pas;*.lfm) or performs an incremental copy, etc.

Another option is to use Main menu > Tools > Configure External Tools. In it we can configure calling any executable file or script using a hotkey. This will allow you to make backups only when you want, and not every compilation.

Since I started using git, I stopped making backups. So I have a lot of hot ones configured for it (status/log/commit).

Plus, it only requires IDE setup, and works for any project with git.

By the way, in the backup settings (in your screenshot) you can simply select the “User defined extensions” option, then the backup files will at least have a different extension ("*.bak"). Then, when searching for files by mask, you will exclude them.

And I wonder why you use "grep" instead of Main menu > Search > Find in files? It provides file search by mask (default is "*.pas;*.pp;*.inc;*.lpr"), supports regular expressions. In the search results window, you can click the desired line to instantly open the file in the editor.


[0] Message Index

[#] Next page

Go to full version