Skip to content

Commit 88001a8

Browse files
Commit
1 parent 77a6c92 commit 88001a8

6 files changed

Lines changed: 8 additions & 6 deletions

File tree

dist/addon.node

0 Bytes
Binary file not shown.

include/placeholders_interface/Placeholders.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Placeholders
77
{
88
public:
9-
static void MaintainIdentity(std::wstring &fullPath, PCWSTR fileIdentity, bool isDirectory);
9+
static void MaintainIdentity(const std::wstring &fullPath, PCWSTR fileIdentity, bool isDirectory);
1010
static void UpdateSyncStatus(const std::wstring &filePath, bool isDirectory);
1111
static void UpdateFileIdentity(const std::wstring &filePath, const std::wstring &fileIdentity, bool isDirectory);
1212
static FileState GetPlaceholderInfo(const std::wstring &directoryPath);

native-src/placeholders_interface/Planceholders.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ std::string cleanString(const std::string &str)
3636
return cleanedStr;
3737
}
3838

39-
void Placeholders::MaintainIdentity(std::wstring &fullPath, PCWSTR itemIdentity, bool isDirectory)
39+
void Placeholders::MaintainIdentity(const std::wstring &fullPath, PCWSTR itemIdentity, bool isDirectory)
4040
{
4141
std::string identity = Placeholders::GetPlaceholderInfo(fullPath).placeholderId;
4242
if (!identity.empty())

native-src/virtual_drive/convert_to_placeholder.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <windows.h>
33
#include "stdafx.h"
44
#include "napi_extract_args.h"
5+
#include "Placeholders.h"
56

67
void convert_to_placeholder(const std::wstring &path, const std::wstring &placeholderId)
78
{
@@ -30,8 +31,11 @@ void convert_to_placeholder(const std::wstring &path, const std::wstring &placeh
3031

3132
HRESULT hr = CfConvertToPlaceholder(fileHandle.get(), idStrLPCVOID, idStrByteLength, convertFlags, &convertUsn, &overlapped);
3233

33-
// Only throw if it's not "already a placeholder" error
34-
if (hr != 0x8007017C)
34+
if (hr == 0x8007017C) // Already a placeholder
35+
{
36+
Placeholders::MaintainIdentity(path, placeholderId.c_str(), isDirectory);
37+
}
38+
else
3539
{
3640
winrt::check_hresult(hr);
3741
}

native-src/virtual_drive/create_file_placeholder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ napi_value create_file_placeholder_impl(napi_env env, napi_callback_info info)
1818
if (std::filesystem::exists(path))
1919
{
2020
convert_to_placeholder(path, placeholderId);
21-
Placeholders::MaintainIdentity(path, placeholderId.c_str(), false);
2221
return nullptr;
2322
}
2423

native-src/virtual_drive/create_folder_placeholder.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ napi_value create_folder_placeholder_impl(napi_env env, napi_callback_info info)
1818
if (std::filesystem::exists(path))
1919
{
2020
convert_to_placeholder(path, placeholderId);
21-
Placeholders::MaintainIdentity(path, placeholderId.c_str(), true);
2221
return nullptr;
2322
}
2423

0 commit comments

Comments
 (0)