Make FileTypes edit resources on resource files and not just applications

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37071 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2010-06-09 14:37:00 +00:00
parent 2ea7b17cf3
commit 0b50919e23
2 changed files with 20 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include <Directory.h>
#include <Entry.h>
#include <Path.h>
#include <Resources.h>
#include <stdio.h>
#include <string.h>
@ -228,7 +229,7 @@ FileTypes::RefsReceived(BMessage *message)
continue;
}
if (!is_application(file)) {
if (!is_application(file) && !is_resource(file)) {
if (entry.GetRef(&ref) == B_OK)
message->ReplaceRef("refs", index - 1, &ref);
continue;
@ -453,6 +454,23 @@ is_application(BFile& file)
}
bool
is_resource(BFile& file)
{
BResources resources(&file);
if (resources.InitCheck() != B_OK)
return false;
BNodeInfo nodeInfo(&file);
char type[B_MIME_TYPE_LENGTH];
if (nodeInfo.GetType(type) != B_OK
|| strcasecmp(type, B_RESOURCE_MIME_TYPE))
return false;
return true;
}
void
error_alert(const char* message, status_t status, alert_type type)
{

View File

@ -30,6 +30,7 @@ static const uint32 kMsgSettingsChanged = 'SeCh';
// exported functions
extern bool is_application(BFile& file);
extern bool is_resource(BFile& file);
extern void error_alert(const char* message, status_t status = B_OK,
alert_type type = B_WARNING_ALERT);