Added awareness for running with a non-native ABI (hybrid build). In this case

we test for a respective subdirectory for any translators path added and use
that instead, if existing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-05-26 01:05:57 +00:00
parent c7d1aa192f
commit 6f2961ffab
2 changed files with 30 additions and 1 deletions
+29 -1
View File
@@ -126,6 +126,7 @@ BTranslatorRoster::Private::Private()
:
BHandler("translator roster"),
BLocker("translator list"),
fABISubDirectory(NULL),
fNextID(1),
fLazyScanning(true),
fSafeMode(false)
@@ -149,6 +150,23 @@ BTranslatorRoster::Private::Private()
fSafeMode = true;
}
// We might run in compatibility mode on a system with a different ABI. The
// translators matching our ABI can usually be found in respective
// subdirectories of the translator directories.
system_info info;
if (get_system_info(&info) == B_OK
&& (info.abi & B_HAIKU_ABI_MAJOR)
!= (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR)) {
switch (B_HAIKU_ABI & B_HAIKU_ABI_MAJOR) {
case B_HAIKU_ABI_GCC_2:
fABISubDirectory = "gcc2";
break;
case B_HAIKU_ABI_GCC_4:
fABISubDirectory = "gcc4";
break;
}
}
// we're sneaking us into the BApplication
if (be_app != NULL && be_app->Lock()) {
be_app->AddHandler(this);
@@ -387,9 +405,19 @@ BTranslatorRoster::Private::AddPath(const char* path, int32* _added)
{
BDirectory directory(path);
status_t status = directory.InitCheck();
if (status < B_OK)
if (status != B_OK)
return status;
// if a subdirectory for our ABI exists, use that instead
if (fABISubDirectory != NULL) {
BEntry entry(&directory, fABISubDirectory);
if (entry.IsDirectory()) {
status = directory.SetTo(&entry);
if (status != B_OK)
return status;
}
}
node_ref nodeRef;
status = directory.GetNodeRef(&nodeRef);
if (status < B_OK)
@@ -112,6 +112,7 @@ private:
TranslatorMap fTranslators;
MessengerList fMessengers;
EntryRefSet fRescanEntries;
const char* fABISubDirectory;
int32 fNextID;
bool fLazyScanning;
bool fSafeMode;