MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / applyLibrary

Method applyLibrary

launcher/minecraft/LaunchProfile.cpp:176–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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