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
+8 -15
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,22 +1755,14 @@ 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, struct stat st;
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++) { status_t error = pathFinder.FindPath(B_FIND_PATH_DATA_DIRECTORY,
struct stat st; "licenses", path);
status_t error = find_directory(directoryConstants[i], &path); if (error == B_OK && path.Append(license) == B_OK
if (error == B_OK && path.Append("licenses") == B_OK && lstat(path.Path(), &st) == 0) {
&& path.Append(license) == B_OK return B_OK;
&& lstat(path.Path(), &st) == 0) {
return B_OK;
}
} }
path.Unset(); path.Unset();