applied patch by John Drinkwater: DataTranslations now only accepts valid translators
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12507 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -63,7 +63,6 @@ void DataTranslationsApplication::Install_Done()
|
|||||||
|
|
||||||
void DataTranslationsApplication::RefsReceived(BMessage *message)
|
void DataTranslationsApplication::RefsReceived(BMessage *message)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32 type;
|
uint32 type;
|
||||||
int32 count;
|
int32 count;
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -71,27 +70,18 @@ void DataTranslationsApplication::RefsReceived(BMessage *message)
|
|||||||
BString newfile;
|
BString newfile;
|
||||||
|
|
||||||
char e_name[B_FILE_NAME_LENGTH];
|
char e_name[B_FILE_NAME_LENGTH];
|
||||||
char mbuf[256];
|
|
||||||
|
|
||||||
|
|
||||||
message->GetInfo("refs", &type, &count);
|
message->GetInfo("refs", &type, &count);
|
||||||
if ( type != B_REF_TYPE ) return;
|
if (type != B_REF_TYPE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (message->FindRef("refs", &ref) == B_OK) {
|
||||||
if ( message->FindRef("refs", &ref) == B_OK )
|
|
||||||
{
|
|
||||||
BEntry entry(&ref, true);
|
BEntry entry(&ref, true);
|
||||||
entry.GetName(e_name);
|
entry.GetName(e_name);
|
||||||
|
|
||||||
if ( entry.IsFile() && entry.GetPath(&path)==B_OK)
|
if (entry.IsFile() && entry.GetPath(&path) == B_OK) {
|
||||||
{
|
BTranslatorRoster *roster = BTranslatorRoster::Default();
|
||||||
BNode node (&entry);
|
if (roster->AddTranslators(path.Path()) == B_OK) {
|
||||||
BNodeInfo info (&node);
|
|
||||||
info.GetType (mbuf);
|
|
||||||
string.SetTo(mbuf);
|
|
||||||
|
|
||||||
if (string.FindFirst("application/x-vnd.Be-elfexecutable") != B_ERROR )
|
|
||||||
{
|
|
||||||
BDirectory dirt("/boot/home/config/add-ons/Translators/");
|
BDirectory dirt("/boot/home/config/add-ons/Translators/");
|
||||||
newfile.SetTo("/boot/home/config/add-ons/Translators/");
|
newfile.SetTo("/boot/home/config/add-ons/Translators/");
|
||||||
newfile << e_name; // Newfile with full path.
|
newfile << e_name; // Newfile with full path.
|
||||||
|
|||||||
@@ -39,8 +39,6 @@ DataTranslationsSettings::DataTranslationsSettings()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
be_app->PostMessage(ERROR_DETECTED);
|
be_app->PostMessage(ERROR_DETECTED);
|
||||||
|
|
||||||
fCorner.PrintToStream();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTranslationsSettings::~DataTranslationsSettings()
|
DataTranslationsSettings::~DataTranslationsSettings()
|
||||||
|
|||||||
Reference in New Issue
Block a user