fs_event_wrap: update to new libuv api

This commit is contained in:
Timothy J Fontaine 2013-10-29 16:46:15 -07:00
parent a35a212f25
commit 74a664b22f

View File

@ -108,17 +108,21 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
String::Utf8Value path(args[0]);
int err = uv_fs_event_init(wrap->env()->event_loop(),
&wrap->handle_,
*path,
OnEvent,
0);
int err = uv_fs_event_init(wrap->env()->event_loop(), &wrap->handle_);
if (err == 0) {
// Check for persistent argument
if (!args[1]->IsTrue()) {
uv_unref(reinterpret_cast<uv_handle_t*>(&wrap->handle_));
}
wrap->initialized_ = true;
err = uv_fs_event_start(&wrap->handle_, OnEvent, *path, 0);
if (err == 0) {
// Check for persistent argument
if (!args[1]->IsTrue()) {
uv_unref(reinterpret_cast<uv_handle_t*>(&wrap->handle_));
}
} else {
FSEventWrap::Close(args);
}
}
args.GetReturnValue().Set(err);