locate plugin with globbing

Bug #334798 reported by Salil
2
Affects Status Importance Assigned to Milestone
Do Plugins
Fix Released
Wishlist
Alex Launi

Bug Description

The locate plugin does not work correctly if the query has globbing characters. eg 'foo*bar' will not return anything even if 'foo bar' exists (and can be found by locate)

the reason appears to be the following:
// Only allow files that contain the query as a substring
// of the file name. It may be faster to use grep, but I've
// tested this and it seems prety snappy.
if (Path.GetFileName (path).ToLower().Contains (query)) {
  results++;
  files.Add (Services.UniverseFactory.NewFileItem (path) as Item);
}

This whole thing is unnecessary.. the "-b" option to locate does what's intended here, without causing the problems that this is causing. I've attached a patch to fix this. Note however that the patch is entirely untested since I don't have compilers etc for C# (but it is such a simple patch that it should not be a problem)

Also it would be nice to have an option that lets me use the regex features of locate. Should I file a separate bug?

Revision history for this message
Salil (hellfeuer) wrote :
Alex Launi (alexlauni)
Changed in do-plugins:
assignee: nobody → alexlauni
importance: Undecided → Wishlist
status: New → Fix Committed
Chris S. (cszikszoy)
Changed in do-plugins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.