std::wstring get_property()

in platforms/Windows/CustomActions/SwiftInstaller/Sources/swift_installer.cc [273:288]


std::wstring get_property(MSIHANDLE hInstall, std::wstring_view key) noexcept {
  DWORD size = 0;
  UINT status;

  status = MsiGetPropertyW(hInstall, key.data(), L"", &size);
  assert(status == ERROR_MORE_DATA);

  std::vector<wchar_t> buffer;
  buffer.resize(size + 1);

  size = buffer.capacity();
  status = MsiGetPropertyW(hInstall, key.data(), buffer.data(), &size);
  // TODO(compnerd) handle error

  return {buffer.data(), buffer.capacity()};
}