Handle argument parsing in C++
This commit is contained in:
parent
3f42909ecf
commit
b3ac48cf52
2 changed files with 13 additions and 18 deletions
|
@ -12,12 +12,23 @@
|
|||
|
||||
namespace {
|
||||
|
||||
bool OpenExternal(const GURL& url, mate::Arguments* args) {
|
||||
bool activate = true;
|
||||
if (args->Length() == 2) {
|
||||
mate::Dictionary options;
|
||||
if (args->GetNext(&options)) {
|
||||
options.Get("activate", &activate);
|
||||
}
|
||||
}
|
||||
return platform_util::OpenExternal(url, activate);
|
||||
}
|
||||
|
||||
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context, void* priv) {
|
||||
mate::Dictionary dict(context->GetIsolate(), exports);
|
||||
dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder);
|
||||
dict.SetMethod("openItem", &platform_util::OpenItem);
|
||||
dict.SetMethod("_openExternal", &platform_util::OpenExternal);
|
||||
dict.SetMethod("openExternal", &OpenExternal);
|
||||
dict.SetMethod("moveItemToTrash", &platform_util::MoveItemToTrash);
|
||||
dict.SetMethod("beep", &platform_util::Beep);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue