MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / applyLibrary

Method applyLibrary

launcher/minecraft/LaunchProfile.cpp:174–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void LaunchProfile::applyLibrary(LibraryPtr library, const RuntimeContext& runtimeContext)
175{
176 if (!library->isActive(runtimeContext)) {
177 return;
178 }
179
180 QList<LibraryPtr>* list = &m_libraries;
181 if (library->isNative()) {
182 list = &m_nativeLibraries;
183 }
184
185 auto libraryCopy = Library::limitedCopy(library);
186
187 // find the library by name.
188 const int index = findLibraryByName(list, library->rawName());
189 // library not found? just add it.
190 if (index < 0) {
191 list->append(libraryCopy);
192 return;
193 }
194
195 auto existingLibrary = list->at(index);
196 // if we are higher it means we should update
197 if (Version(library->version()) > Version(existingLibrary->version())) {
198 list->replace(index, libraryCopy);
199 }
200}
201
202void LaunchProfile::applyMavenFile(LibraryPtr mavenFile, const RuntimeContext& runtimeContext)
203{

Callers 1

applyToMethod · 0.80

Calls 8

findLibraryByNameFunction · 0.85
isNativeMethod · 0.80
appendMethod · 0.80
VersionClass · 0.70
isActiveMethod · 0.45
atMethod · 0.45
versionMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected