Try to load resource-embedded catalog from application. Should fix #8037.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42950 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues
2011-10-29 14:35:55 +00:00
parent eab1b0e87e
commit 92bae21ab7
+13 -4
View File
@@ -65,9 +65,17 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language,
: :
BHashMapCatalog(signature, language, fingerprint) BHashMapCatalog(signature, language, fingerprint)
{ {
// give highest priority to catalog living in sub-folder of app's folder: status_t status;
app_info appInfo; app_info appInfo;
be_app->GetAppInfo(&appInfo); be_app->GetAppInfo(&appInfo);
// give highest priority to catalog embedded as resource in application
// executable:
status = ReadFromResource(&appInfo.ref);
// search for catalog living in sub-folder of app's folder:
if (status != B_OK) {
node_ref nref; node_ref nref;
nref.device = appInfo.ref.device; nref.device = appInfo.ref.device;
nref.node = appInfo.ref.directory; nref.node = appInfo.ref.directory;
@@ -78,7 +86,8 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language,
<< "/" << fLanguageName << "/" << fLanguageName
<< kCatExtension; << kCatExtension;
BPath catalogPath(&appDir, catalogName.String()); BPath catalogPath(&appDir, catalogName.String());
status_t status = ReadFromFile(catalogPath.Path()); status = ReadFromFile(catalogPath.Path());
}
if (status != B_OK) { if (status != B_OK) {
// search in data folders // search in data folders
@@ -92,8 +101,8 @@ DefaultCatalog::DefaultCatalog(const char *signature, const char *language,
for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) { for (size_t i = 0; i < sizeof(which) / sizeof(which[0]); i++) {
BPath path; BPath path;
if (find_directory(which[i], &path) == B_OK) { if (find_directory(which[i], &path) == B_OK) {
catalogName = BString(path.Path()) BString catalogName(path.Path());
<< "/locale/" << kCatFolder catalogName << "/locale/" << kCatFolder
<< "/" << fSignature << "/" << fSignature
<< "/" << fLanguageName << "/" << fLanguageName
<< kCatExtension; << kCatExtension;