mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-11 22:49:56 +00:00
Qt: Validate renames against the card's own extension
Renaming a card that is not a .ps2 was rejected outright.
This commit is contained in:
@@ -249,10 +249,12 @@ void MemoryCardSettingsWidget::renameCard()
|
|||||||
if (newName.isEmpty() || newName == selectedCard)
|
if (newName.isEmpty() || newName == selectedCard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!newName.endsWith(QStringLiteral(".ps2")) || newName.length() <= 4)
|
const qsizetype extensionPos = selectedCard.lastIndexOf('.');
|
||||||
|
const QString extension(extensionPos >= 0 ? selectedCard.mid(extensionPos) : QString());
|
||||||
|
if (!newName.endsWith(extension, Qt::CaseInsensitive) || newName.length() <= extension.length())
|
||||||
{
|
{
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(QtUtils::GetRootWidget(this), tr("Rename Memory Card"),
|
||||||
QtUtils::GetRootWidget(this), tr("Rename Memory Card"), tr("New name is invalid, it must end with .ps2"));
|
tr("New name is invalid, it must end with %1").arg(extension));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user