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.
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.
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.
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.
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.