From 0d81d790911f033ff495aec66b4d076fb1723248 Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Thu, 9 Apr 2009 02:48:02 +0000 Subject: [PATCH] * Removed hardcoded system location, now use find_directory() * Fixed a bug I've miss last time: everything under /boot/system was considered a server team, including system apps and demos! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30051 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../devices/keyboard/TeamListItem.cpp | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp b/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp index 7fd464ad4a..49da1ffa53 100644 --- a/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp +++ b/src/add-ons/input_server/devices/keyboard/TeamListItem.cpp @@ -10,7 +10,9 @@ #include +#include #include +#include #include @@ -115,15 +117,31 @@ TeamListItem::GetInfo() bool TeamListItem::IsSystemServer() { - // TODO: use find_directory() in place of hardcoded paths + static bool firstCall = true; + static BPath systemServersPath; + static BPath trackerPath; + static BPath deskbarPath; + + if (firstCall) { + find_directory(B_SYSTEM_SERVERS_DIRECTORY, &systemServersPath); - char* system = "/boot/system/"; - if (strncmp(system, fInfo.args, strlen(system)) == 0) + find_directory(B_SYSTEM_DIRECTORY, &trackerPath); + trackerPath.Append("Tracker"); + + find_directory(B_SYSTEM_DIRECTORY, &deskbarPath); + deskbarPath.Append("Deskbar"); + + firstCall = false; + } + + if (strncmp(systemServersPath.Path(), fInfo.args, strlen(systemServersPath.Path())) == 0) return true; - system = "/system/servers/"; - if (strncmp(system, fInfo.args, strlen(system)) == 0) + if (strncmp(trackerPath.Path(), fInfo.args, strlen(trackerPath.Path())) == 0) return true; - return false; + if (strncmp(deskbarPath.Path(), fInfo.args, strlen(deskbarPath.Path())) == 0) + return true; + + return false; }