Fixed: Unable to find a shortcut

--HG--
branch : develop
This commit is contained in:
kervala 2016-10-01 13:05:11 +02:00
parent f39e135494
commit f17f7954ac
3 changed files with 21 additions and 2 deletions

View file

@ -676,7 +676,7 @@ bool CConfigFile::shouldCreateDesktopShortcut() const
QString shortcut = profile.getClientDesktopShortcutFullPath(); 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 bool CConfigFile::shouldCreateMenuShortcut() const
@ -687,7 +687,7 @@ bool CConfigFile::shouldCreateMenuShortcut() const
QString shortcut = profile.getClientMenuShortcutFullPath(); 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 bool CConfigFile::shouldCopyInstaller() const

View file

@ -282,6 +282,24 @@ bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathOb
#endif #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) QString getVersionFromExecutable(const QString &path)
{ {
// launch executable with --version argument // launch executable with --version argument

View file

@ -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 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); bool resolveLink(const QWidget &window, const QString &pathLink, QString &pathObj);
QString appendLinkExtension(const QString &link);
QString getVersionFromExecutable(const QString &path); QString getVersionFromExecutable(const QString &path);