From fd8b35c86b4dd3b5cb090dbb3c8318f7711148fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Thu, 5 Jul 2007 00:28:02 +0000 Subject: [PATCH] Allow application signature as argument. If target has a replicant (e.g. ProcessController) give that precedence over desklink replicant. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21563 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/desklink/desklink.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/bin/desklink/desklink.cpp b/src/bin/desklink/desklink.cpp index 691860d9df..ef4b1fbc50 100644 --- a/src/bin/desklink/desklink.cpp +++ b/src/bin/desklink/desklink.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -421,18 +422,30 @@ main(int, char **argv) atLeastOnePath = true; BEntry entry(argv[i], true); - if(!entry.Exists()) { + entry_ref ref; + + if(entry.Exists()) { + entry.GetRef(&ref); + } + else if (BMimeType::IsValid(argv[i])) { + if (be_roster->FindApp(argv[i], &ref) != B_OK) { + printf("desklink: cannot find '%s'\n", argv[i]); + return 1; + } + } + else { printf("desklink: cannot find '%s'\n", argv[i]); return 1; } - - entry_ref ref; - entry.GetRef(&ref); - - err = deskbar.AddItem(new DeskButton(BRect(0, 0, 15, 15), - &ref, "DeskButton", titleList, actionList)); + + err = deskbar.AddItem(&ref); if (err != B_OK) { - printf("desklink: Deskbar refuses link to '%s': %s\n", argv[i], strerror(err)); + err = deskbar.AddItem(new DeskButton(BRect(0, 0, 15, 15), + &ref, "DeskButton", titleList, actionList)); + if (err != B_OK) { + printf("desklink: Deskbar refuses link to '%s': %s\n", argv[i], strerror(err)); + return 1; + } } titleList.MakeEmpty(); @@ -440,7 +453,7 @@ main(int, char **argv) } if (!atLeastOnePath) { - printf( "usage: desklink { [ --list|--remove|[cmd=title:action ... ] path ] } ...\n" + printf( "usage: desklink { [ --list|--remove|[cmd=title:action ... ] [ path|signature ] } ...\n" "--list: list all Deskbar addons.\n" "--remove: delete all desklink addons.\n"); return 1;