Skip to content

Simplify main#202

Merged
dajimenezriv-internxt merged 3 commits into
masterfrom
simplify_main
Oct 29, 2025
Merged

Simplify main#202
dajimenezriv-internxt merged 3 commits into
masterfrom
simplify_main

Conversation

@dajimenezriv-internxt

Copy link
Copy Markdown
Contributor

No description provided.

@dajimenezriv-internxt dajimenezriv-internxt self-assigned this Oct 25, 2025
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Comment thread native-src/main.cpp

napi_status defineStatus = napi_define_properties(env, exports, 1, &desc);
if (defineStatus != napi_ok)
if (napi_define_properties(env, exports, 14, properties) != napi_ok)

Copy link
Copy Markdown
Contributor Author

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);

Copy link
Copy Markdown
Contributor Author

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);

Copy link
Copy Markdown
Contributor Author

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

@dajimenezriv-internxt dajimenezriv-internxt Oct 27, 2025

Copy link
Copy Markdown
Contributor Author

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.

@dajimenezriv-internxt dajimenezriv-internxt merged commit 2de9c92 into master Oct 29, 2025
3 of 4 checks passed
@dajimenezriv-internxt dajimenezriv-internxt deleted the simplify_main branch October 29, 2025 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants