MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / load_licenses

Method load_licenses

src/GlobalConfig.cpp:195–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void 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}

Callers 1

load_configMethod · 0.80

Calls 6

read_file_to_stringFunction · 0.85
sortFunction · 0.85
c_strMethod · 0.80
stringMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected