-
Notifications
You must be signed in to change notification settings - Fork 1
Simplify main #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify main #202
Conversation
|
|
|
||
| napi_status defineStatus = napi_define_properties(env, exports, 1, &desc); | ||
| if (defineStatus != napi_ok) | ||
| if (napi_define_properties(env, exports, 14, properties) != napi_ok) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of defining all functions one by one we define all of them at the same time. See that we replaced 1 by 14 which is the number of elements in the array.
| napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); | ||
| napi_value update_sync_status_wrapper(napi_env env, napi_callback_info info) | ||
| { | ||
| auto [path, isDirectory] = napi_extract_args<std::wstring, bool>(env, info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses a template to extract args instead of doing the extraction manually like before.
| ::Sleep(CHUNKDELAYMS); | ||
| Placeholders::UpdatePinState(ctxPtr->fullClientPath.c_str(), PinState::AlwaysLocal); | ||
|
|
||
| CfSetPinState(handleForPath(ctxPtr->fullClientPath.c_str()).get(), CF_PIN_STATE_PINNED, CF_SET_PIN_FLAG_NONE, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same that UpdatePinState was doing before.
|
|
||
| HRESULT hr = CfSetInSyncState(h, sync, CF_SET_IN_SYNC_FLAG_NONE, nullptr); | ||
|
|
||
| if (FAILED(hr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't care about the different types of errors, we just throw the error. If this is not inside a cloud provider (second case) we are going to have an error before reaching this function and if the file is not a placeholder (third case) we are going to have an error before reaching this function too.


No description provided.