Skip to content

Commit b90e7fe

Browse files
Commit
1 parent 0ee3179 commit b90e7fe

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

dist/addon.node

0 Bytes
Binary file not shown.

native-src/sync_root_interface/callbacks/CancelFetchData/CancelFetchDataCallback.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,20 @@ struct CallbackContext
1818

1919
struct CancelFetchDataArgs
2020
{
21-
std::wstring fileIdentityArg;
21+
std::wstring pathArg;
2222
CallbackContext *context;
2323

24-
CancelFetchDataArgs(const std::wstring &fileId, CallbackContext *ctx)
25-
: fileIdentityArg(fileId), context(ctx) {}
24+
CancelFetchDataArgs(const std::wstring &path, CallbackContext *ctx) : pathArg(path), context(ctx) {}
2625
};
2726

2827
void notify_cancel_fetch_data_call(napi_env env, napi_value js_callback, void *context, void *data)
2928
{
3029
CancelFetchDataArgs *args = static_cast<CancelFetchDataArgs *>(data);
31-
std::u16string u16_fileIdentity(args->fileIdentityArg.begin(), args->fileIdentityArg.end());
3230

33-
napi_value js_string;
34-
napi_create_string_utf16(env, u16_fileIdentity.c_str(), u16_fileIdentity.size(), &js_string);
31+
napi_value js_path;
32+
napi_create_string_utf16(env, (char16_t *)args->pathArg.c_str(), args->pathArg.length(), &js_path);
3533

36-
napi_value args_to_js_callback[1] = {js_string};
34+
napi_value args_to_js_callback[1] = {js_path};
3735

3836
napi_value undefined;
3937
napi_get_undefined(env, &undefined);
@@ -50,14 +48,12 @@ void notify_cancel_fetch_data_call(napi_env env, napi_value js_callback, void *c
5048

5149
void CALLBACK cancel_fetch_data_callback_wrapper(_In_ CONST CF_CALLBACK_INFO *callbackInfo, _In_ CONST CF_CALLBACK_PARAMETERS *callbackParameters)
5250
{
53-
LPCVOID fileIdentity = callbackInfo->FileIdentity;
54-
DWORD fileIdentityLength = callbackInfo->FileIdentityLength;
51+
std::wstring path = std::wstring(callbackInfo->VolumeDosName) + callbackInfo->NormalizedPath;
5552

56-
const wchar_t *wchar_ptr = static_cast<const wchar_t *>(fileIdentity);
57-
std::wstring fileIdentityStr(wchar_ptr, fileIdentityLength / sizeof(wchar_t));
53+
wprintf(L"Cancel fetch data path: %s\n", path.c_str());
5854

5955
CallbackContext context;
60-
CancelFetchDataArgs *args = new CancelFetchDataArgs(fileIdentityStr, &context);
56+
CancelFetchDataArgs *args = new CancelFetchDataArgs(path, &context);
6157

6258
napi_call_threadsafe_function(g_cancel_fetch_data_threadsafe_callback, args, napi_tsfn_blocking);
6359

native-src/sync_root_interface/callbacks/FetchData/FetchData.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ napi_value response_callback_fn_fetch_data(napi_env env, napi_callback_info info
6060

6161
if (finished)
6262
{
63-
wprintf(L"Hydration finished\n");
63+
wprintf(L"Fetch data finished\n");
6464

6565
CfSetPinState(handleForPath(ctx->path.c_str()).get(), CF_PIN_STATE_PINNED, CF_SET_PIN_FLAG_NONE, nullptr);
6666

@@ -136,7 +136,7 @@ void CALLBACK fetch_data_callback_wrapper(_In_ CONST CF_CALLBACK_INFO *callbackI
136136
ctx->callbackInfo = *callbackInfo;
137137
ctx->path = std::wstring(callbackInfo->VolumeDosName) + callbackInfo->NormalizedPath;
138138

139-
wprintf(L"Download path: %s\n", ctx->path.c_str());
139+
wprintf(L"Fetch data path: %s\n", ctx->path.c_str());
140140

141141
napi_call_threadsafe_function(g_fetch_data_threadsafe_callback, ctx.get(), napi_tsfn_blocking);
142142

0 commit comments

Comments
 (0)