| 634 | } |
| 635 | |
| 636 | static QString replaceTokensIn(QString text, QMap<QString, QString> with) |
| 637 | { |
| 638 | // TODO: does this still work?? |
| 639 | QString result; |
| 640 | QRegularExpression token_regexp("\\$\\{(.+)\\}", QRegularExpression::InvertedGreedinessOption); |
| 641 | QStringList list; |
| 642 | QRegularExpressionMatchIterator i = token_regexp.globalMatch(text); |
| 643 | int lastCapturedEnd = 0; |
| 644 | while (i.hasNext()) { |
| 645 | QRegularExpressionMatch match = i.next(); |
| 646 | result.append(text.mid(lastCapturedEnd, match.capturedStart())); |
| 647 | QString key = match.captured(1); |
| 648 | auto iter = with.find(key); |
| 649 | if (iter != with.end()) { |
| 650 | result.append(*iter); |
| 651 | } |
| 652 | lastCapturedEnd = match.capturedEnd(); |
| 653 | } |
| 654 | result.append(text.mid(lastCapturedEnd)); |
| 655 | return result; |
| 656 | } |
| 657 | |
| 658 | QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session, MinecraftTarget::Ptr targetToJoin) const |
| 659 | { |
no test coverage detected