[haiku-commits] haiku: hrev47134 - src/apps/aboutsystem

  • From: jessica.l.hamilton@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 19 Apr 2014 15:10:55 +0200 (CEST)

hrev47134 adds 1 changeset to branch 'master'
old head: 8173945dc4cd8ca64848096d6f2219dba7f95bcd
new head: 07fae11ef898713d80462312addd8136df9ec081
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=07fae11+%5E8173945

----------------------------------------------------------------------------

07fae11: AboutSystem: use BPathFinder instead of find_directory.

                         [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev47134
Commit:      07fae11ef898713d80462312addd8136df9ec081
URL:         http://cgit.haiku-os.org/haiku/commit/?id=07fae11
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Sat Apr 19 13:06:06 2014 UTC

----------------------------------------------------------------------------

1 file changed, 9 insertions(+), 16 deletions(-)
src/apps/aboutsystem/AboutSystem.cpp | 25 +++++++++----------------

----------------------------------------------------------------------------

diff --git a/src/apps/aboutsystem/AboutSystem.cpp 
b/src/apps/aboutsystem/AboutSystem.cpp
index 5cf1558..71405ae 100644
--- a/src/apps/aboutsystem/AboutSystem.cpp
+++ b/src/apps/aboutsystem/AboutSystem.cpp
@@ -31,6 +31,7 @@
 #include <Messenger.h>
 #include <OS.h>
 #include <Path.h>
+#include <PathFinder.h>
 #include <Resources.h>
 #include <Screen.h>
 #include <ScrollView.h>
@@ -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;
-
-       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;
-               }
+       BPathFinder pathFinder;
+       struct stat st;
+
+       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();


Other related posts:

  • » [haiku-commits] haiku: hrev47134 - src/apps/aboutsystem - jessica . l . hamilton