fixed RefsReceived initialization bug, added AppTypeWindow handling to ArgReceived

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4307 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2003-08-18 22:22:58 +00:00
parent ed9b1292f5
commit d1ac83129d
1 changed files with 26 additions and 1 deletions

View File

@ -60,7 +60,7 @@ void
FileTypeApp::RefsReceived(BMessage * message)
{
BList entryList;
int32 i;
int32 i = 0;
entry_ref ref;
while (message->FindRef("refs",i++,&ref) == B_OK) {
BEntry * entry = new BEntry(&ref,true);
@ -183,6 +183,31 @@ FileTypeApp::ArgvReceived(int32 argc, const char * argv[], const char * cwd)
PrintUsage(argv[0]);
return;
}
if (entryList.CountItems() == 1) {
BEntry * entry = static_cast<BEntry*>(entryList.FirstItem());
BNode node(entry);
if (node.InitCheck() != B_OK) {
delete entry;
return;
}
BNodeInfo nodeInfo(&node);
if (nodeInfo.InitCheck() != B_OK) {
delete entry;
return;
}
char string[MAXPATHLEN];
if ((nodeInfo.GetType(string) == B_OK)
&& (strcmp(string,"application/x-vnd.Be-elfexecutable") == 0)) {
AppTypeWindow * window = new AppTypeWindow(entry);
if (window->InitCheck() == B_OK) {
fWindow = window;
fArgvOkay = true;
} else {
printf("Failed to create AppTypeWindow\n");
}
return;
}
}
FileTypeWindow * window = new FileTypeWindow(&entryList);
if (window->InitCheck() != B_OK) {
printf("Failed to create FileTypeWindow\n");