Skip to content

Commit 350682f

Browse files
Extract remove outside c++ (#177)
1 parent 7195ba0 commit 350682f

16 files changed

Lines changed: 2 additions & 489 deletions

File tree

.github/workflows/check-pr-size.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1 @@
1-
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/internxt/node-win)
2-
3-
# Setup
4-
5-
This guide explains how to set up and build the `node-win` project.
6-
7-
## Prerequisites
8-
9-
Before proceeding, ensure you have the following tools installed:
10-
11-
- **Python 3.10**
12-
- **Node 20**
13-
14-
```bash
15-
nvm install 20
16-
```
17-
18-
- **node-gyp**
19-
20-
```bash
21-
npm install -g node-gyp
22-
```
23-
24-
- **Visual Studio** (not VS Code) for building native dependencies.
25-
26-
## Build Steps
27-
28-
Run the following command to build the project:
29-
30-
```bash
31-
npm run build
32-
```
33-
34-
This step compiles the necessary native bindings.
1+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/internxt/node-win)

binding.gyp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
"native-src/sync_root_interface/callbacks/FetchData/FetchData.cpp",
2727
"native-src/sync_root_interface/callbacks/FetchData/FileCopierWithProgress.cpp",
2828
"native-src/sync_root_interface/callbacks/FetchData/TransferContext.cpp",
29-
"native-src/sync_root_interface/callbacks/FetchPlaceholder/FetchPlaceholder.cpp",
30-
"native-src/sync_root_interface/callbacks/NotifyDelete/NotifyDeleteCallback.cpp",
3129
"native-src/virtual_drive/Wrappers.cpp"
3230
],
3331
"include_dirs": [

dist/addon.node

-10.5 KB
Binary file not shown.

include/placeholders_interface/Placeholders.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class Placeholders
4747
static void UpdateSyncStatus(const std::wstring &filePath, bool syncState, bool isDirectory);
4848
static HRESULT UpdatePinState(const std::wstring &path, const PinState state);
4949
static CF_PLACEHOLDER_STATE GetPlaceholderState(const std::wstring &filePath);
50-
static std::vector<std::wstring> GetPlaceholderWithStatePending(const std::wstring &filePath);
51-
static bool IsFileValidForSync(const std::wstring &filePath);
5250
static PlaceholderResult ConvertToPlaceholder(const std::wstring &fullPath, const std::wstring &serverIdentity);
5351
static std::string GetFileIdentity(const std::wstring &filePath);
5452
static void UpdateFileIdentity(const std::wstring &filePath, const std::wstring &fileIdentity, bool isDirectory);

include/sync_root_interface/callbacks/Callbacks.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
void register_threadsafe_callbacks(napi_env env, InputSyncCallbacks input);
66

7-
// Notify Delete Callback
8-
void register_threadsafe_notify_delete_callback(const std::string &resource_name, napi_env env, InputSyncCallbacks input);
9-
void CALLBACK notify_delete_callback_wrapper(_In_ CONST CF_CALLBACK_INFO *callbackInfo, _In_ CONST CF_CALLBACK_PARAMETERS *callbackParameters);
10-
11-
// Fetch Placeholders Callback
12-
void register_threadsafe_fetch_placeholders_callback(const std::string &resource_name, napi_env env, InputSyncCallbacks input);
13-
void CALLBACK fetch_placeholders_callback_wrapper(_In_ CONST CF_CALLBACK_INFO *callbackInfo, _In_ CONST CF_CALLBACK_PARAMETERS *callbackParameters);
14-
157
// Fetch Data Callback
168
void register_threadsafe_fetch_data_callback(const std::string &resource_name, napi_env env, InputSyncCallbacks input);
179
void CALLBACK fetch_data_callback_wrapper(_In_ CONST CF_CALLBACK_INFO *callbackInfo, _In_ CONST CF_CALLBACK_PARAMETERS *callbackParameters);

include/sync_root_interface/callbacks/CallbacksContext.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,5 @@
1111

1212
struct InputSyncCallbacks {
1313
napi_ref fetch_data_callback_ref;
14-
napi_ref validate_data_callback_ref;
1514
napi_ref cancel_fetch_data_callback_ref;
16-
napi_ref fetch_placeholders_callback_ref;
17-
napi_ref cancel_fetch_placeholders_callback_ref;
18-
napi_ref notify_file_open_completion_callback_ref;
19-
napi_ref notify_file_close_completion_callback_ref;
20-
napi_ref notify_dehydrate_callback_ref;
21-
napi_ref notify_dehydrate_completion_callback_ref;
22-
napi_ref notify_delete_callback_ref;
23-
napi_ref notify_delete_completion_callback_ref;
24-
napi_ref none_callback_ref;
2515
};

include/virtual_drive/Wrappers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ napi_value GetFileIdentityWrapper(napi_env env, napi_callback_info args);
1313
napi_value addLoggerPathWrapper(napi_env env, napi_callback_info args);
1414
napi_value UpdateSyncStatusWrapper(napi_env env, napi_callback_info args);
1515
napi_value GetPlaceholderStateWrapper(napi_env env, napi_callback_info args);
16-
napi_value GetPlaceholderWithStatePendingWrapper(napi_env env, napi_callback_info args);
1716
napi_value ConvertToPlaceholderWrapper(napi_env env, napi_callback_info args);
1817
napi_value DeleteFileSyncRootWrapper(napi_env env, napi_callback_info args);
1918
napi_value UpdateFileIdentityWrapper(napi_env env, napi_callback_info args);

native-src/main.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,23 +213,6 @@ napi_value init(napi_env env, napi_value exports)
213213
return nullptr;
214214
}
215215

216-
napi_property_descriptor getPlaceholderWithStatePendingDesc = {
217-
"getPlaceholderWithStatePending",
218-
nullptr,
219-
GetPlaceholderWithStatePendingWrapper,
220-
nullptr,
221-
nullptr,
222-
nullptr,
223-
napi_default,
224-
nullptr};
225-
226-
napi_status defineGetPlaceholderWithStatePendingStatus = napi_define_properties(env, exports, 1, &getPlaceholderWithStatePendingDesc);
227-
if (defineGetPlaceholderWithStatePendingStatus != napi_ok)
228-
{
229-
napi_throw_error(env, nullptr, "Failed to define getPlaceholderWithStatePending function");
230-
return nullptr;
231-
}
232-
233216
napi_property_descriptor convertToPlaceholderDesc = {
234217
"convertToPlaceholder",
235218
nullptr,

native-src/placeholders_interface/Planceholders.cpp

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -493,99 +493,6 @@ FileState Placeholders::GetPlaceholderInfo(const std::wstring &directoryPath)
493493
return fileState;
494494
}
495495

496-
std::vector<std::wstring> Placeholders::GetPlaceholderWithStatePending(const std::wstring &directoryPath)
497-
{
498-
std::vector<std::wstring> resultPaths;
499-
500-
try
501-
{
502-
for (const auto &entry : std::filesystem::directory_iterator(directoryPath, std::filesystem::directory_options::skip_permission_denied))
503-
{
504-
const auto &path = entry.path().wstring();
505-
506-
if (entry.is_directory())
507-
{
508-
FileState folderState = Placeholders::GetPlaceholderInfo(path);
509-
510-
if (folderState.syncstate == SyncState::Undefined || folderState.syncstate == SyncState::NotInSync)
511-
{
512-
std::vector<std::wstring> subfolderPaths = GetPlaceholderWithStatePending(path);
513-
resultPaths.insert(resultPaths.end(), subfolderPaths.begin(), subfolderPaths.end());
514-
}
515-
}
516-
else if (entry.is_regular_file())
517-
{
518-
FileState placeholderState = Placeholders::GetPlaceholderInfo(path);
519-
520-
bool isFileValidForSync = (placeholderState.syncstate == SyncState::Undefined || placeholderState.syncstate == SyncState::NotInSync);
521-
if (isFileValidForSync && IsFileValidForSync(path))
522-
{
523-
resultPaths.push_back(path);
524-
}
525-
}
526-
}
527-
}
528-
catch (const std::exception &e)
529-
{
530-
wprintf(L"[GetPlaceholderWithStatePending] Error: %s\n", e.what());
531-
}
532-
533-
return resultPaths;
534-
}
535-
bool Placeholders::IsFileValidForSync(const std::wstring &filePath)
536-
{
537-
// Obtener un handle al archivo
538-
HANDLE fileHandle = CreateFileW(
539-
filePath.c_str(),
540-
FILE_READ_ATTRIBUTES,
541-
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
542-
nullptr,
543-
OPEN_EXISTING,
544-
FILE_ATTRIBUTE_NORMAL,
545-
nullptr);
546-
547-
if (fileHandle == INVALID_HANDLE_VALUE)
548-
{
549-
// No se pudo abrir el archivo
550-
return false;
551-
}
552-
553-
// Verificar si el archivo está vacío
554-
LARGE_INTEGER fileSize;
555-
if (!GetFileSizeEx(fileHandle, &fileSize))
556-
{
557-
CloseHandle(fileHandle);
558-
return false;
559-
}
560-
561-
if (fileSize.QuadPart == 0)
562-
{
563-
CloseHandle(fileHandle);
564-
return false;
565-
}
566-
567-
LARGE_INTEGER maxFileSize;
568-
maxFileSize.QuadPart = 40LL * 1024 * 1024 * 1024; // 20GB
569-
570-
if (fileSize.QuadPart > maxFileSize.QuadPart)
571-
{
572-
CloseHandle(fileHandle);
573-
return false;
574-
}
575-
576-
// // Verificar la extensión del archivo
577-
if (std::filesystem::path(filePath).extension().empty())
578-
{
579-
CloseHandle(fileHandle);
580-
return false;
581-
}
582-
583-
// Cerrar el handle del archivo
584-
CloseHandle(fileHandle);
585-
586-
return true;
587-
}
588-
589496
void Placeholders::ForceShellRefresh(const std::wstring &path)
590497
{
591498
SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH, path.c_str(), nullptr);

0 commit comments

Comments
 (0)