diff options
author | Brad King <brad.king@kitware.com> | 2020-01-27 14:32:43 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-27 14:32:51 (GMT) |
commit | d5f54967831851a5625b05920939004f1bb0c92e (patch) | |
tree | 694947c30adaf20e4c380bbfc2dd396a48b8a6ee /Source/CPack | |
parent | 647ff12ca65ef4d1ac1bae70bd6ce558d95bfb23 (diff) | |
parent | 95719297018a35f58be49ec09162296df5e520ee (diff) | |
download | CMake-d5f54967831851a5625b05920939004f1bb0c92e.zip CMake-d5f54967831851a5625b05920939004f1bb0c92e.tar.gz CMake-d5f54967831851a5625b05920939004f1bb0c92e.tar.bz2 |
Merge topic 'cpack-dmg-rtf-for-sla'
9571929701 CPack/DragNDrop: Support RTF licenses
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4270
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 3516235..ad8f50f 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -138,11 +138,16 @@ int cmCPackDragNDropGenerator::InitializeInternal() } for (auto const& language : languages) { std::string license = slaDirectory + "/" + language + ".license.txt"; - if (!singleLicense && !cmSystemTools::FileExists(license)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Missing license file " << language << ".license.txt" - << std::endl); - return 0; + std::string license_rtf = slaDirectory + "/" + language + ".license.rtf"; + if (!singleLicense) { + if (!cmSystemTools::FileExists(license) && + !cmSystemTools::FileExists(license_rtf)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Missing license file " + << language << ".license.txt" + << " / " << language << ".license.rtf" << std::endl); + return 0; + } } std::string menu = slaDirectory + "/" + language + ".menu.txt"; if (!cmSystemTools::FileExists(menu)) { @@ -793,13 +798,29 @@ bool cmCPackDragNDropGenerator::WriteLicense( licenseLanguage = "English"; } + // License file + std::string license_format = "TEXT"; + std::string actual_license; + if (!licenseFile.empty()) { + if (cmHasLiteralSuffix(licenseFile, ".rtf")) { + license_format = "RTF "; + } + actual_license = licenseFile; + } else { + std::string license_wo_ext = + slaDirectory + "/" + licenseLanguage + ".license"; + if (cmSystemTools::FileExists(license_wo_ext + ".txt")) { + actual_license = license_wo_ext + ".txt"; + } else { + license_format = "RTF "; + actual_license = license_wo_ext + ".rtf"; + } + } + // License header - outputStream << "data 'TEXT' (" << licenseNumber << ", \"" << licenseLanguage - << "\") {\n"; + outputStream << "data '" << license_format << "' (" << licenseNumber + << ", \"" << licenseLanguage << "\") {\n"; // License body - std::string actual_license = !licenseFile.empty() - ? licenseFile - : (slaDirectory + "/" + licenseLanguage + ".license.txt"); cmsys::ifstream license_ifs; license_ifs.open(actual_license.c_str()); if (license_ifs.is_open()) { |