GExperts Grep can use the MAP file

The GExperts Grep Search expert has various options to tell it which files to search:

  • The current file
  • All files in project
  • All files in project group
  • A directory list (separated by semicolon)

That sounds like an exhaustive list, but it isn’t. Both, project and project group, were only searching files explicitly listed in the project(s). Files that were linked into the project using the search path, were not searched.

Until now, that is: There is now an option to use the MAP file instead of the DPR file for project search.

The MAP file is created by the linker and contains a list of all source files linked into the program. By default, that file is not created though, you must explicitly enable it on the Linker page of the project options.

The least detailed setting “Segments” is sufficient for the new Grep functionality. If there is no MAP file, it falls back to the original method of searching files listed in the DPR file.

Beware that this will also search units located in the RTL / VCL and FMX source directories. This might not be what you want. I plan to add some more flexibility in the future.

There is no release yet and it might take a while until I feel like doing one, but you can always compile your own GExperts DLL. Make sure you delete the existing directory AppData\roaming\GExperts\DelphiXXX\UsesExpertCache when you replace the DLL with the new one.

Discussion about this post at https://en.delphipraxis.net/topic/793-gexperts-grep-can-use-the-map-file/