AboutSystem: use BPathFinder instead of find_directory.

This commit is contained in:
Jessica Hamilton
2014-04-20 01:06:06 +12:00
parent 8173945dc4
commit 07fae11ef8
+6 -13
View File
@@ -31,6 +31,7 @@
#include <Messenger.h> #include <Messenger.h>
#include <OS.h> #include <OS.h>
#include <Path.h> #include <Path.h>
#include <PathFinder.h>
#include <Resources.h> #include <Resources.h>
#include <Screen.h> #include <Screen.h>
#include <ScrollView.h> #include <ScrollView.h>
@@ -1754,23 +1755,15 @@ AboutView::_CreateCreditsView()
status_t status_t
AboutView::_GetLicensePath(const char* license, BPath& path) AboutView::_GetLicensePath(const char* license, BPath& path)
{ {
static const directory_which directoryConstants[] = { BPathFinder pathFinder;
B_USER_NONPACKAGED_DATA_DIRECTORY,
B_USER_DATA_DIRECTORY,
B_SYSTEM_NONPACKAGED_DATA_DIRECTORY,
B_SYSTEM_DATA_DIRECTORY
};
static const int dirCount = 4;
for (int i = 0; i < dirCount; i++) {
struct stat st; struct stat st;
status_t error = find_directory(directoryConstants[i], &path);
if (error == B_OK && path.Append("licenses") == B_OK status_t error = pathFinder.FindPath(B_FIND_PATH_DATA_DIRECTORY,
&& path.Append(license) == B_OK "licenses", path);
if (error == B_OK && path.Append(license) == B_OK
&& lstat(path.Path(), &st) == 0) { && lstat(path.Path(), &st) == 0) {
return B_OK; return B_OK;
} }
}
path.Unset(); path.Unset();
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;