| 127 | } |
| 128 | |
| 129 | void LaunchProfile::applyLibrary(LibraryPtr library) |
| 130 | { |
| 131 | if(!library->isActive()) |
| 132 | { |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | QList<LibraryPtr> * list = &m_libraries; |
| 137 | if(library->isNative()) |
| 138 | { |
| 139 | list = &m_nativeLibraries; |
| 140 | } |
| 141 | |
| 142 | auto libraryCopy = Library::limitedCopy(library); |
| 143 | |
| 144 | // find the library by name. |
| 145 | const int index = findLibraryByName(list, library->rawName()); |
| 146 | // library not found? just add it. |
| 147 | if (index < 0) |
| 148 | { |
| 149 | list->append(libraryCopy); |
| 150 | return; |
| 151 | } |
| 152 | |
| 153 | auto existingLibrary = list->at(index); |
| 154 | // if we are higher it means we should update |
| 155 | if (Version(library->version()) > Version(existingLibrary->version())) |
| 156 | { |
| 157 | list->replace(index, libraryCopy); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | void LaunchProfile::applyMavenFile(LibraryPtr mavenFile) |
| 162 | { |