hrev47362 adds 1 changeset to branch 'master' old head: abca6dabb6d6f7b9a3b854f8745365cbfeac381c new head: d2da54dee23b5d4c24889d7bbde2eb7803f79ab9 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=d2da54d+%5Eabca6da ---------------------------------------------------------------------------- d2da54d: Shortcuts: use BPathFinder instead of find_directory. Fixes #9958. * Previously, BPath::Append() would return an empty path if the path didn't exist (and an error); in a nightly image, the B_USER_ADDONS_DIRECTORY didn't exist, triggering the bug. * Replaced the code with calls to BPathFinder instead, which takes care of the empty path automatically. [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47362 Commit: d2da54dee23b5d4c24889d7bbde2eb7803f79ab9 URL: http://cgit.haiku-os.org/haiku/commit/?id=d2da54d Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> Date: Fri Jun 13 03:38:52 2014 UTC Ticket: https://dev.haiku-os.org/ticket/9958 ---------------------------------------------------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) .../filters/shortcut_catcher/KeyCommandMap.cpp | 45 ++++++-------------- ---------------------------------------------------------------------------- diff --git a/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp b/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp index 8ebfa34..b4d6ae5 100644 --- a/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp +++ b/src/add-ons/input_server/filters/shortcut_catcher/KeyCommandMap.cpp @@ -19,7 +19,9 @@ #include <NodeMonitor.h> #include <OS.h> #include <Path.h> +#include <PathFinder.h> #include <PathMonitor.h> +#include <StringList.h> #include <WindowScreen.h> #include "BitFieldTesters.h" @@ -265,39 +267,20 @@ KeyCommandMap::MessageReceived(BMessage* message) // Leave handling of add-ons shortcuts to Tracker BString command; - if (message.FindString("command", &command) == B_OK) { - BPath path; - if (find_directory(B_SYSTEM_ADDONS_DIRECTORY, &path) - == B_OK) { - path.Append("Tracker/"); - if (command.FindFirst(path.Path()) != B_ERROR) - continue; - } - - if (find_directory( - B_SYSTEM_NONPACKAGED_ADDONS_DIRECTORY, &path) - == B_OK) { - path.Append("Tracker/"); - if (command.FindFirst(path.Path()) != B_ERROR) - continue; - } - - if (find_directory(B_USER_ADDONS_DIRECTORY, &path) - == B_OK) { - path.Append("Tracker/"); - if (command.FindFirst(path.Path()) != B_ERROR) - continue; - } - - if (find_directory( - B_USER_NONPACKAGED_ADDONS_DIRECTORY, &path) - == B_OK) { - path.Append("Tracker/"); - if (command.FindFirst(path.Path()) != B_ERROR) - continue; + if (msg.FindString("command", &command) == B_OK) { + BStringList paths; + BPathFinder::FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY, + "Tracker/", paths); + bool foundAddOn = false; + for (uint32 i = 0; i < paths.CountStrings(); i++) { + if (command.FindFirst(paths.StringAt(i)) + != B_ERROR) { + foundAddOn = true; + break; + } } + if (foundAddOn) continue; } - BArchivable* archive = instantiate_object(&testerMessage); if (BitFieldTester* tester = dynamic_cast<BitFieldTester*>(archive)) {