only load user addons when not in safe mode
fixes bug #842 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18817 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
|
#include <driver_settings.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
@@ -30,6 +31,14 @@
|
|||||||
#include <new>
|
#include <new>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
extern "C" status_t _kern_get_safemode_option(const char *parameter,
|
||||||
|
char *buffer, size_t *_bufferSize);
|
||||||
|
#else
|
||||||
|
extern "C" status_t _kget_safemode_option_(const char *parameter,
|
||||||
|
char *buffer, size_t *_bufferSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(HAIKU_TARGET_PLATFORM_HAIKU) && !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
|
#if !defined(HAIKU_TARGET_PLATFORM_HAIKU) && !defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
|
||||||
// building under R5 or Dano/Zeta
|
// building under R5 or Dano/Zeta
|
||||||
@@ -124,8 +133,25 @@ QuarantineTranslatorImage::Remove()
|
|||||||
BTranslatorRoster::Private::Private()
|
BTranslatorRoster::Private::Private()
|
||||||
: BHandler("translator roster"), BLocker("translator list"),
|
: BHandler("translator roster"), BLocker("translator list"),
|
||||||
fNextID(1),
|
fNextID(1),
|
||||||
fLazyScanning(true)
|
fLazyScanning(true),
|
||||||
|
fSafeMode(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
char parameter[32];
|
||||||
|
size_t parameterLength = sizeof(parameter);
|
||||||
|
|
||||||
|
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
|
||||||
|
if (_kern_get_safemode_option(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK)
|
||||||
|
#else
|
||||||
|
if (_kget_safemode_option_(B_SAFEMODE_SAFE_MODE, parameter, ¶meterLength) == B_OK)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (!strcasecmp(parameter, "enabled") || !strcasecmp(parameter, "on")
|
||||||
|
|| !strcasecmp(parameter, "true") || !strcasecmp(parameter, "yes")
|
||||||
|
|| !strcasecmp(parameter, "enable") || !strcmp(parameter, "1"))
|
||||||
|
fSafeMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
// we're sneaking us into the BApplication
|
// we're sneaking us into the BApplication
|
||||||
if (be_app != NULL && be_app->Lock()) {
|
if (be_app != NULL && be_app->Lock()) {
|
||||||
be_app->AddHandler(this);
|
be_app->AddHandler(this);
|
||||||
@@ -288,7 +314,7 @@ BTranslatorRoster::Private::AddDefaultPaths()
|
|||||||
B_BEOS_ADDONS_DIRECTORY,
|
B_BEOS_ADDONS_DIRECTORY,
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uint32 i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
for (uint32 i = fSafeMode ? 1 : 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
|
||||||
BPath path;
|
BPath path;
|
||||||
status_t status = find_directory(paths[i], &path, true);
|
status_t status = find_directory(paths[i], &path, true);
|
||||||
if (status == B_OK && path.Append("Translators") == B_OK) {
|
if (status == B_OK && path.Append("Translators") == B_OK) {
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class BTranslatorRoster::Private : public BHandler, public BLocker {
|
|||||||
EntryRefSet fRescanEntries;
|
EntryRefSet fRescanEntries;
|
||||||
int32 fNextID;
|
int32 fNextID;
|
||||||
bool fLazyScanning;
|
bool fLazyScanning;
|
||||||
|
bool fSafeMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSLATOR_ROSTER_PRIVATE_H
|
#endif // TRANSLATOR_ROSTER_PRIVATE_H
|
||||||
|
|||||||
Reference in New Issue
Block a user