mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Match GetPayloadPath code in nearby/internal/platform/implementation/windows/platform.cc
PiperOrigin-RevId: 427062438
This commit is contained in:
@@ -519,11 +519,15 @@ std::string GetPayloadPath(location::nearby::PayloadId payload_id) {
|
||||
// process is responsible for freeing this resource once it
|
||||
// is no longer needed by calling CoTaskMemFree, whether
|
||||
// SHGetKnownFolderPath succeeds or not.
|
||||
|
||||
char *fullpathUTF8 = new char((wcslen(basePath) + 1) * sizeof(char));
|
||||
wcstombs(fullpathUTF8, basePath, (wcslen(basePath) + 1) * sizeof(char));
|
||||
|
||||
return absl::StrCat(fullpathUTF8, "\\", payload_id);
|
||||
size_t bufferSize;
|
||||
wcstombs_s(&bufferSize, NULL, 0, basePath, 0);
|
||||
char *fullpathUTF8 = new char[bufferSize + 1];
|
||||
memset(fullpathUTF8, 0, bufferSize);
|
||||
wcstombs_s(&bufferSize, fullpathUTF8, bufferSize, basePath, bufferSize - 1);
|
||||
std::string fullPath = std::string(fullpathUTF8);
|
||||
auto retval = absl::StrCat(fullPath, "\\", payload_id);
|
||||
delete[] fullpathUTF8;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void SendPayloadDart(Core *pCore, const char *endpoint_id,
|
||||
|
||||
Reference in New Issue
Block a user