From d1ac83129de74541556c83463f02de28bc945b46 Mon Sep 17 00:00:00 2001 From: shatty Date: Mon, 18 Aug 2003 22:22:58 +0000 Subject: [PATCH] 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 --- src/add-ons/tracker/filetype/FileTypeApp.cpp | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/add-ons/tracker/filetype/FileTypeApp.cpp b/src/add-ons/tracker/filetype/FileTypeApp.cpp index db2e50a7d4..2fa704b7f2 100644 --- a/src/add-ons/tracker/filetype/FileTypeApp.cpp +++ b/src/add-ons/tracker/filetype/FileTypeApp.cpp @@ -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(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");