From 07fae11ef898713d80462312addd8136df9ec081 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Sun, 20 Apr 2014 01:06:06 +1200 Subject: [PATCH] AboutSystem: use BPathFinder instead of find_directory. --- src/apps/aboutsystem/AboutSystem.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 5cf1558f43..71405aefab 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -1754,22 +1755,14 @@ AboutView::_CreateCreditsView() status_t AboutView::_GetLicensePath(const char* license, BPath& path) { - static const directory_which directoryConstants[] = { - B_USER_NONPACKAGED_DATA_DIRECTORY, - B_USER_DATA_DIRECTORY, - B_SYSTEM_NONPACKAGED_DATA_DIRECTORY, - B_SYSTEM_DATA_DIRECTORY - }; - static const int dirCount = 4; + BPathFinder pathFinder; + struct stat st; - for (int i = 0; i < dirCount; i++) { - struct stat st; - status_t error = find_directory(directoryConstants[i], &path); - if (error == B_OK && path.Append("licenses") == B_OK - && path.Append(license) == B_OK - && lstat(path.Path(), &st) == 0) { - return B_OK; - } + status_t error = pathFinder.FindPath(B_FIND_PATH_DATA_DIRECTORY, + "licenses", path); + if (error == B_OK && path.Append(license) == B_OK + && lstat(path.Path(), &st) == 0) { + return B_OK; } path.Unset();