Skip to content

Commit cfaea1e

Browse files
authored
qt_gui: Fix shortcut's name got cut off in some cases (#2116)
Example: P.T. -> P
1 parent 4a21d94 commit cfaea1e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/qt_gui/gui_context_menus.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class GuiContextMenus : public QObject {
283283
#ifdef Q_OS_WIN
284284
if (createShortcutWin(linkPath, ebootPath, icoPath, exePath)) {
285285
#else
286-
if (createShortcutLinux(linkPath, ebootPath, iconPath)) {
286+
if (createShortcutLinux(linkPath, m_games[itemID].name, ebootPath, iconPath)) {
287287
#endif
288288
QMessageBox::information(
289289
nullptr, tr("Shortcut creation"),
@@ -301,7 +301,7 @@ class GuiContextMenus : public QObject {
301301
#ifdef Q_OS_WIN
302302
if (createShortcutWin(linkPath, ebootPath, iconPath, exePath)) {
303303
#else
304-
if (createShortcutLinux(linkPath, ebootPath, iconPath)) {
304+
if (createShortcutLinux(linkPath, m_games[itemID].name, ebootPath, iconPath)) {
305305
#endif
306306
QMessageBox::information(
307307
nullptr, tr("Shortcut creation"),
@@ -510,8 +510,8 @@ class GuiContextMenus : public QObject {
510510
return SUCCEEDED(hres);
511511
}
512512
#else
513-
bool createShortcutLinux(const QString& linkPath, const QString& targetPath,
514-
const QString& iconPath) {
513+
bool createShortcutLinux(const QString& linkPath, const std::string& name,
514+
const QString& targetPath, const QString& iconPath) {
515515
QFile shortcutFile(linkPath);
516516
if (!shortcutFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
517517
QMessageBox::critical(nullptr, "Error",
@@ -522,7 +522,7 @@ class GuiContextMenus : public QObject {
522522
QTextStream out(&shortcutFile);
523523
out << "[Desktop Entry]\n";
524524
out << "Version=1.0\n";
525-
out << "Name=" << QFileInfo(linkPath).baseName() << "\n";
525+
out << "Name=" << QString::fromStdString(name) << "\n";
526526
out << "Exec=" << QCoreApplication::applicationFilePath() << " \"" << targetPath << "\"\n";
527527
out << "Icon=" << iconPath << "\n";
528528
out << "Terminal=false\n";

0 commit comments

Comments
 (0)