mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
chore: make all the regexes static const (#3647)
This commit is contained in:
@ -43,5 +43,6 @@ void ATLauncher::loadIndexedPack(ATLauncher::IndexedPack& m, QJsonObject& obj)
|
||||
m.system = Json::ensureBoolean(obj, QString("system"), false);
|
||||
m.description = Json::ensureString(obj, "description", "");
|
||||
|
||||
m.safeName = Json::requireString(obj, "name").replace(QRegularExpression("[^A-Za-z0-9]"), "").toLower() + ".png";
|
||||
static const QRegularExpression s_regex("[^A-Za-z0-9]");
|
||||
m.safeName = Json::requireString(obj, "name").replace(s_regex, "").toLower() + ".png";
|
||||
}
|
||||
|
@ -69,7 +69,8 @@ PackInstallTask::PackInstallTask(UserInteractionSupport* support, QString packNa
|
||||
{
|
||||
m_support = support;
|
||||
m_pack_name = packName;
|
||||
m_pack_safe_name = packName.replace(QRegularExpression("[^A-Za-z0-9]"), "");
|
||||
static const QRegularExpression s_regex("[^A-Za-z0-9]");
|
||||
m_pack_safe_name = packName.replace(s_regex, "");
|
||||
m_version_name = version;
|
||||
m_install_mode = installMode;
|
||||
}
|
||||
@ -938,7 +939,8 @@ bool PackInstallTask::extractMods(const QMap<QString, VersionMod>& toExtract,
|
||||
QString folderToExtract = "";
|
||||
if (mod.type == ModType::Extract) {
|
||||
folderToExtract = mod.extractFolder;
|
||||
folderToExtract.remove(QRegularExpression("^/"));
|
||||
static const QRegularExpression s_regex("^/");
|
||||
folderToExtract.remove(s_regex);
|
||||
}
|
||||
|
||||
qDebug() << "Extracting " + mod.file + " to " + extractToDir;
|
||||
|
@ -391,7 +391,8 @@ bool FlameCreationTask::createInstance()
|
||||
|
||||
// Hack to correct some 'special sauce'...
|
||||
if (mcVersion.endsWith('.')) {
|
||||
mcVersion.remove(QRegularExpression("[.]+$"));
|
||||
static const QRegularExpression s_regex("[.]+$");
|
||||
mcVersion.remove(s_regex);
|
||||
logWarning(tr("Mysterious trailing dots removed from Minecraft version while importing pack."));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user