From cddcc2bea95011c47b7a9ee25b630e2f639a1191 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 31 Oct 2011 11:00:01 +0000 Subject: [PATCH] Fix MutableLocaleRoster::GetSystemCatalog() * Using a hardcoded path is bad, since the library folder might change and/or the /system/lib/libbe.so may not be the libbe.so actually in use. Instead, we now lookup the loaded libbe-image and get the entry_ref from its image_info. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43029 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/locale/MutableLocaleRoster.cpp | 27 +++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/kits/locale/MutableLocaleRoster.cpp b/src/kits/locale/MutableLocaleRoster.cpp index 738b2d18f2..9c282542e8 100644 --- a/src/kits/locale/MutableLocaleRoster.cpp +++ b/src/kits/locale/MutableLocaleRoster.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -788,10 +789,32 @@ MutableLocaleRoster::GetSystemCatalog(BCatalogAddOn** catalog) const { if (!catalog) return B_BAD_VALUE; - // get libbe entry_ref + + // figure out libbe-image (shared object) by name + image_info info; + int32 cookie = 0; + bool found = false; + + while (get_next_image_info(0, &cookie, &info) == B_OK) { + if (info.data < (void*)&be_app + && (char*)info.data + info.data_size > (void*)&be_app) { + found = true; + break; + } + } + + if (!found) { + log_team(LOG_DEBUG, "Unable to find libbe-image!"); + + return B_ERROR; + } + + // load the catalog for libbe and return it to the app entry_ref ref; - BEntry("/boot/system/lib/libbe.so").GetRef(&ref); + BEntry(info.name).GetRef(&ref); + *catalog = LoadCatalog(ref); + return B_OK; }