urlwrapper: Handle the doi: URI scheme
The DOI (Digital Object Identifier) is a unique identifier for (scientific and other...) publications. While the doi: URI scheme was only a draft, it's not totally unlikely that we ever hit such a URI, in this case we just redirect to the official DOI website. cf. http://tools.ietf.org/html/draft-paskin-doi-uri
This commit is contained in:
@@ -222,6 +222,7 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv)
|
|||||||
const char* failc = " || read -p 'Press any key'";
|
const char* failc = " || read -p 'Press any key'";
|
||||||
const char* pausec = " ; read -p 'Press any key'";
|
const char* pausec = " ; read -p 'Press any key'";
|
||||||
char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL};
|
char* args[] = { (char *)"/bin/sh", (char *)"-c", NULL, NULL};
|
||||||
|
status_t err;
|
||||||
|
|
||||||
BPrivate::Support::BUrl url(argv[1]);
|
BPrivate::Support::BUrl url(argv[1]);
|
||||||
|
|
||||||
@@ -503,6 +504,25 @@ UrlWrapper::ArgvReceived(int32 argc, char** argv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (proto == "doi") {
|
||||||
|
BString url("http://dx.doi.org/");
|
||||||
|
BString mimetype;
|
||||||
|
|
||||||
|
url << full;
|
||||||
|
BPrivate::Support::BUrl u(url.String());
|
||||||
|
args[0] = const_cast<char*>("urlwrapper"); //XXX
|
||||||
|
args[1] = (char*)u.String();
|
||||||
|
args[2] = NULL;
|
||||||
|
mimetype = kURLHandlerSigBase;
|
||||||
|
mimetype += u.Proto();
|
||||||
|
|
||||||
|
err = be_roster->Launch(mimetype.String(), 1, args + 1);
|
||||||
|
if (err != B_OK && err != B_ALREADY_RUNNING)
|
||||||
|
err = be_roster->Launch(kAppSig, 1, args + 1);
|
||||||
|
// TODO: handle errors
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
More ?
|
More ?
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ resource(1, "BEOS:FILE_TYPES") message
|
|||||||
"types" = "application/x-vnd.Be.URL.ssh",
|
"types" = "application/x-vnd.Be.URL.ssh",
|
||||||
"types" = "application/x-vnd.Be.URL.ftp",
|
"types" = "application/x-vnd.Be.URL.ftp",
|
||||||
"types" = "application/x-vnd.Be.URL.sftp",
|
"types" = "application/x-vnd.Be.URL.sftp",
|
||||||
"types" = "application/x-vnd.Be.URL.finger"
|
"types" = "application/x-vnd.Be.URL.finger",
|
||||||
|
"types" = "application/x-vnd.Be.URL.doi"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user