Я пытался портировать сценарий NSIS исходного ответа на C++:
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// Helper function to write hexadecimal bytes to a file.
void FileWriteHexBytes(std::ofstream &file, const std::string &hexBytes) {
for (size_t i = 0; i < hexBytes.length(); i += 2) {
std::string byteString = hexBytes.substr(i, 2);
unsigned char byte = static_cast(std::stoi(byteString, nullptr, 16));
file.write(reinterpret_cast(&byte), 1);
}
}
// Function to create a relative symbolic link file.
void CreateRelativeLnk(const std::string &filePath, const std::string &relativeTargetPath) {
std::ofstream file(filePath, std::ios::binary);
if (!file) {
std::cerr
Подробнее здесь: [url]https://stackoverflow.com/questions/79037927/create-a-relative-path-shortcut-with-the-sldf-has-relpath-flag-in-c[/url]