E-mail: Use BPathFinder to collect add-ons.

This commit is contained in:
Axel Dörfler
2016-01-14 20:50:18 +01:00
parent 7e267cd3b5
commit 94834e20a8
+9 -14
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2011-2015, Haiku, Inc. All rights reserved. * Copyright 2011-2016, Haiku, Inc. All rights reserved.
* Copyright 2011, Clemens Zeidler <[email protected]> * Copyright 2011, Clemens Zeidler <[email protected]>
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -11,7 +11,7 @@
#include <stdio.h> #include <stdio.h>
#include <Directory.h> #include <Directory.h>
#include <FindDirectory.h> #include <PathFinder.h>
#include <Path.h> #include <Path.h>
@@ -35,19 +35,14 @@ FilterList::Reload()
std::set<BString> knownNames; std::set<BString> knownNames;
directory_which which[] = {B_USER_ADDONS_DIRECTORY, BString subPath("mail_daemon/");
B_SYSTEM_ADDONS_DIRECTORY}; subPath << (fDirection == kIncoming
for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) { ? "inbound_filters" : "outbound_filters");
BPath path;
status_t status = find_directory(which[i], &path);
if (status != B_OK)
continue;
path.Append("mail_daemon"); BStringList paths;
if (fDirection == kIncoming) BPathFinder().FindPaths(B_FIND_PATH_ADD_ONS_DIRECTORY, subPath, paths);
path.Append("inbound_filters"); for (int32 i = 0; i < paths.CountStrings(); i++) {
else BPath path(paths.StringAt(i));
path.Append("outbound_filters");
BDirectory dir(path.Path()); BDirectory dir(path.Path());
if (dir.InitCheck() != B_OK) if (dir.InitCheck() != B_OK)