find/replace file filter should not filter above the project root dir?
René J.V. Bertin
rjvbertin at gmail.com
Sun May 15 09:41:47 UTC 2016
On Sunday May 15 2016 10:40:17 Aleix Pol wrote:
>> Compare this with the inclusive filter: I do not get *.cpp or *.h files from above the search directory, so why would the exclusive filter consider paths above that?
>
>That's not the case. You're either doing something wrong or hitting a bug.
What is not the case, what I say about the include filter or about the exclude filter? What I'm doing is simply a right-click on a directory in the project manager view and clicking "Search/Replace in Files". In my workflow I often get the error "no files matching pattern", which is evidently not desired when you're expecting to search the C and C++ files of a project that you know has lots of those.
The exclude filter does QDir.match(exclude, "full-path-to-file-or-dir-to-be-searched"), which cannot but filter on the complete path.
The include filter does a similar operation, but AFAI understood only files under the search location are submitted to QDir.match.
You probably saw my RR for this feature: removing `dirname $search-location` (shell equivalent) from the path submitted to the QDir.match(exclude) call gives the behaviour I expect. In fact, I had to dive into the source to understand why I got those "no matching files found) errors in certain cases, and could fix that error by moving the source directory to a different location (replacing it with a symlink to the new location).
So yeah, I consider exclude-filtering on the whole path a bug. I actually think that the exclude filter should not even be applied on the search location itself, but only on path components below that location. I don't think you'd want to have to remove the "/build/" exclude filter term if you want to search in (under) your build directory (for instance to check if cmake files or generated header or resource files contain the intended information).
I only didn't implement my patch that way because locations like the build dir are usually not shown in the project manager view, but you can still enter them manually in the search location widget.
R.
More information about the KDevelop-devel
mailing list