source-insight

How to save configuration template in Source Insight?


I'm working on a project with many similar branches. I'd like to configure Source Insight "once and for all"--to spend the time analyzing the huge project for which files/directories should be included and excluded, and then saving that as a configuration, so that when starting a new project in a branch, I could get started almost immediately, with only minor tweaks.

Is there a way to save project configuration information into a template, to use on future projects?


Solution

  • Source Insight has a few ways to add a list of files and directories to a project. The easiest way is to go to Project > Add And Remove Project Files..., select "add from list", then select a file. This file can containt absolute file paths or paths relative to the Project Source Directory specified in Project > Project Settings. You can also use the AddFileListToProj(hprj, listfilename) function in a Source Insight macro if you'd like to do it that way. From the documentation:

    Adds a list of files to the project hprj. The listfilename parameter is a string containing the name of the list file. The list file should be a text file containing one file name per line. The file can also contain one directory per line, in which case the directory's contents are added to the project.

    Now, you just need to create the list of files. You can either do it externally however you wish, or you can let Source Insight create one from a previous project. To do this, simiply open the project you want to use as your "template" and go to Project > Project Report. Uncheck all of the boxes and click "OK". Now delete the header lines from the top of the report and the "total files..." line from the bottom. You should be left with a list of all the files in the project relative to the project source directory. Save this file to use to add files to new projects in the future.