CPack/NSIS: Avoid UNIX-style paths in macro variables
NSIS macro variables MUI_*_BITMAP require Windows-style paths. Don't rely on the user and convert them explicitly. For good measure, also convert the paths for MUI_PAGE_LICENSE, MUI_ICON and MUI_UNIICON. Note that NSIS scripts only require quotes for strings with spaces and ConvertToWindowsOutputPath() handles this automatically. Fixes: #9945
This commit is contained in:
parent
b18513105c
commit
d1f00444d1
@ -130,11 +130,13 @@ int cmCPackNSISGenerator::PackageFiles()
|
||||
if (this->IsSet("CPACK_NSIS_MUI_ICON") ||
|
||||
this->IsSet("CPACK_NSIS_MUI_UNIICON")) {
|
||||
std::string installerIconCode;
|
||||
if (cmValue icon = this->GetOptionIfSet("CPACK_NSIS_MUI_ICON")) {
|
||||
installerIconCode += cmStrCat("!define MUI_ICON \"", *icon, "\"\n");
|
||||
if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_MUI_ICON")) {
|
||||
std::string iconFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
|
||||
installerIconCode += cmStrCat("!define MUI_ICON ", iconFile, "\n");
|
||||
}
|
||||
if (cmValue icon = this->GetOptionIfSet("CPACK_NSIS_MUI_UNIICON")) {
|
||||
installerIconCode += cmStrCat("!define MUI_UNICON \"", *icon, "\"\n");
|
||||
if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_MUI_UNIICON")) {
|
||||
std::string iconFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
|
||||
installerIconCode += cmStrCat("!define MUI_UNICON ", iconFile, "\n");
|
||||
}
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_ICON_CODE",
|
||||
installerIconCode.c_str());
|
||||
@ -146,24 +148,28 @@ int cmCPackNSISGenerator::PackageFiles()
|
||||
installerHeaderImage = *icon;
|
||||
}
|
||||
if (!installerHeaderImage.empty()) {
|
||||
std::string installerIconCode = cmStrCat(
|
||||
"!define MUI_HEADERIMAGE_BITMAP \"", installerHeaderImage, "\"\n");
|
||||
installerHeaderImage =
|
||||
cmSystemTools::ConvertToWindowsOutputPath(installerHeaderImage);
|
||||
std::string installerIconCode =
|
||||
cmStrCat("!define MUI_HEADERIMAGE_BITMAP ", installerHeaderImage, "\n");
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_ICON_CODE",
|
||||
installerIconCode);
|
||||
}
|
||||
|
||||
if (cmValue v =
|
||||
this->GetOptionIfSet("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP")) {
|
||||
std::string bitmapFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
|
||||
std::string installerBitmapCode =
|
||||
cmStrCat("!define MUI_WELCOMEFINISHPAGE_BITMAP \"", *v, "\"\n");
|
||||
cmStrCat("!define MUI_WELCOMEFINISHPAGE_BITMAP ", bitmapFile, "\n");
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE",
|
||||
installerBitmapCode);
|
||||
}
|
||||
|
||||
if (cmValue v =
|
||||
this->GetOptionIfSet("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP")) {
|
||||
std::string bitmapFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
|
||||
std::string installerBitmapCode =
|
||||
cmStrCat("!define MUI_UNWELCOMEFINISHPAGE_BITMAP \"", *v, "\"\n");
|
||||
cmStrCat("!define MUI_UNWELCOMEFINISHPAGE_BITMAP ", bitmapFile, "\n");
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE",
|
||||
installerBitmapCode);
|
||||
}
|
||||
@ -231,9 +237,10 @@ int cmCPackNSISGenerator::PackageFiles()
|
||||
}
|
||||
|
||||
if (!this->IsSet("CPACK_NSIS_IGNORE_LICENSE_PAGE")) {
|
||||
cmValue v = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
|
||||
std::string licenseFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
|
||||
std::string licenseCode =
|
||||
cmStrCat("!insertmacro MUI_PAGE_LICENSE \"",
|
||||
this->GetOption("CPACK_RESOURCE_FILE_LICENSE"), "\"\n");
|
||||
cmStrCat("!insertmacro MUI_PAGE_LICENSE ", licenseFile, "\n");
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_LICENSE_PAGE", licenseCode);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user