diff options
author | Andrew Fuller <afuller@teradici.com> | 2020-01-23 16:50:45 (GMT) |
---|---|---|
committer | Andrew Fuller <afuller@teradici.com> | 2020-01-24 15:48:52 (GMT) |
commit | 95719297018a35f58be49ec09162296df5e520ee (patch) | |
tree | 04e35ac2147fc316dd7b454e2a0e05a9d02a24aa /Source/CPack/cmCPackDragNDropGenerator.cxx | |
parent | ab2fc918216011a03f0fe7696e7bba67fc2627b3 (diff) | |
download | CMake-95719297018a35f58be49ec09162296df5e520ee.zip CMake-95719297018a35f58be49ec09162296df5e520ee.tar.gz CMake-95719297018a35f58be49ec09162296df5e520ee.tar.bz2 |
CPack/DragNDrop: Support RTF licenses
Diffstat (limited to 'Source/CPack/cmCPackDragNDropGenerator.cxx')
-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()) { |