From c087023d2946b4aefc300ed15eca820330767460 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 1 Oct 2016 13:05:11 +0200 Subject: [PATCH] Fixed: Unable to find a shortcut --- .../client/ryzom_installer/src/configfile.cpp | 4 ++-- .../tools/client/ryzom_installer/src/utils.cpp | 18 ++++++++++++++++++ .../tools/client/ryzom_installer/src/utils.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index c9ca60b9e..34bbf300e 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -676,7 +676,7 @@ bool CConfigFile::shouldCreateDesktopShortcut() const QString shortcut = profile.getClientDesktopShortcutFullPath(); - return !shortcut.isEmpty() && !NLMISC::CFile::isExists(qToUtf8(shortcut)); + return !shortcut.isEmpty() && !NLMISC::CFile::isExists(qToUtf8(appendLinkExtension(shortcut))); } bool CConfigFile::shouldCreateMenuShortcut() const @@ -687,7 +687,7 @@ bool CConfigFile::shouldCreateMenuShortcut() const QString shortcut = profile.getClientMenuShortcutFullPath(); - return !shortcut.isEmpty() && !NLMISC::CFile::isExists(qToUtf8(shortcut)); + return !shortcut.isEmpty() && !NLMISC::CFile::isExists(qToUtf8(appendLinkExtension(shortcut))); } bool CConfigFile::shouldCopyInstaller() const diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp index a06ca053b..c4c9e3a02 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.cpp @@ -282,6 +282,24 @@ bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathOb #endif +QString appendLinkExtension(const QString &link) +{ + QString extension; + +#ifdef Q_OS_WIN32 + extension = ".lnk"; +#elif Q_OS_MAC + // TODO +#else + extension = ".desktop"; +#endif + + // already the good extension + if (link.indexOf(extension) > -1) return link; + + return link + extension; +} + QString getVersionFromExecutable(const QString &path) { // launch executable with --version argument diff --git a/code/ryzom/tools/client/ryzom_installer/src/utils.h b/code/ryzom/tools/client/ryzom_installer/src/utils.h index 1ad94b24b..e5df1812d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/utils.h +++ b/code/ryzom/tools/client/ryzom_installer/src/utils.h @@ -52,6 +52,7 @@ wchar_t* qToWide(const QString &str); bool createLink(const QString &link, const QString &name, const QString &executable, const QString &arguments, const QString &icon, const QString &workingDir); bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj); +QString appendLinkExtension(const QString &link); QString getVersionFromExecutable(const QString &path);