Launch URLs via BUrl class. Rearranged header files according to guidelines.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30759 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8ca914d177
commit
e56cb27512
|
@ -1,22 +1,25 @@
|
|||
/*
|
||||
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2005-2007, François Revol, revol@free.fr.
|
||||
* Copyright 2009, Jonas Sundström, jonas@kirilla.com.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*! Launches an application/document from the shell */
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Entry.h>
|
||||
#include <List.h>
|
||||
#include <Mime.h>
|
||||
#include <Roster.h>
|
||||
#include <String.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <Url.h>
|
||||
|
||||
|
||||
const char *kTrackerSignature = "application/x-vnd.Be-TRAK";
|
||||
|
@ -86,25 +89,15 @@ main(int argc, char **argv)
|
|||
status = B_OK;
|
||||
} else if (strchr(*argv, ':')) {
|
||||
// try to open it as an URI
|
||||
BString mimeType = "application/x-vnd.Be.URL.";
|
||||
BString arg(*argv);
|
||||
mimeType.Append(arg, arg.FindFirst(":"));
|
||||
|
||||
// the protocol should be alphanum
|
||||
// we just check if it's registered
|
||||
// if not there is likely no supporting app anyway
|
||||
if (BMimeType::IsValid(mimeType.String())) {
|
||||
char *args[2] = { *argv, NULL };
|
||||
status = be_roster->Launch(openWith ? openWith
|
||||
: mimeType.String(), 1, args);
|
||||
if (status == B_OK)
|
||||
continue;
|
||||
}
|
||||
BPrivate::Support::BUrl url(*argv);
|
||||
if (url.OpenWithPreferredApplication() == B_OK)
|
||||
continue;
|
||||
|
||||
// maybe it's "file:line" or "file:line:col"
|
||||
int line = 0, col = 0, i;
|
||||
status = B_ENTRY_NOT_FOUND;
|
||||
// remove gcc error's last :
|
||||
BString arg(*argv);
|
||||
if (arg[arg.Length() - 1] == ':')
|
||||
arg.Truncate(arg.Length() - 1);
|
||||
|
||||
|
|
Loading…
Reference in New Issue