| 193 | } |
| 194 | |
| 195 | void GlobalConfig::load_licenses() { |
| 196 | { |
| 197 | int globCount; |
| 198 | std::filesystem::path third_party_license_path("data/third_party_licenses"); |
| 199 | char** filesInPath = SDL_GlobDirectory(third_party_license_path.string().c_str(), nullptr, 0, &globCount); |
| 200 | if(filesInPath) { |
| 201 | for(int i = 0; i < globCount; i++) { |
| 202 | std::filesystem::path filePath = third_party_license_path / std::filesystem::path(filesInPath[i]); |
| 203 | SDL_PathInfo fileInfo; |
| 204 | if(SDL_GetPathInfo(filePath.string().c_str(), &fileInfo) && fileInfo.type == SDL_PATHTYPE_FILE) { |
| 205 | thirdPartyLicenses.emplace_back(filePath.filename().string(), read_file_to_string(filePath)); |
| 206 | } |
| 207 | } |
| 208 | SDL_free(filesInPath); |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | std::sort(thirdPartyLicenses.begin(), thirdPartyLicenses.end(), [](const auto& a1, const auto& a2) { |
| 213 | return std::lexicographical_compare(a1.first.begin(), a1.first.end(), a2.first.begin(), a2.first.end()); |
| 214 | }); |
| 215 | ownLicenseText = "InfiniPaint v" + VersionConstants::CURRENT_VERSION_STRING + "\n"; |
| 216 | ownLicenseText += read_file_to_string("data/license"); |
| 217 | } |
no test coverage detected