mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-30 07:48:31 +03:00
Integrating feedbacks provided by jturcotte
This commit is contained in:
parent
9351c5eefa
commit
f3bdfef9cf
1 changed files with 4 additions and 6 deletions
|
@ -38,17 +38,15 @@ static void setupFavLink_private(const QString &folder)
|
|||
{
|
||||
// Windows Explorer: Place under "Favorites" (Links)
|
||||
|
||||
SHGetKnownFolderPathFun SHGetKnownFolderPathPtr = NULL;
|
||||
SHGetFolderPathFun SHGetFolderPathPtr = NULL;
|
||||
static SHGetKnownFolderPathFun SHGetKnownFolderPathPtr = NULL;
|
||||
QString linkName;
|
||||
QDir folderDir(QDir::fromNativeSeparators(folder));
|
||||
if((!SHGetKnownFolderPathPtr) && (!SHGetFolderPathPtr))
|
||||
if (!SHGetKnownFolderPathPtr)
|
||||
{
|
||||
QLibrary kernel32Lib("shell32.dll");
|
||||
if(kernel32Lib.load())
|
||||
{
|
||||
SHGetKnownFolderPathPtr = (SHGetKnownFolderPathFun) kernel32Lib.resolve("SHGetKnownFolderPath");
|
||||
SHGetFolderPathPtr = (SHGetFolderPathFun) kernel32Lib.resolve("SHGetFolderPathW");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,8 +54,8 @@ static void setupFavLink_private(const QString &folder)
|
|||
/* Use new WINAPI functions */
|
||||
wchar_t *path = NULL;
|
||||
if(SHGetKnownFolderPathPtr(FOLDERID_Links, 0, NULL, &path) == S_OK) {
|
||||
QString Links= QDir::fromNativeSeparators(QString::fromWCharArray(path));
|
||||
linkName = QDir(Links).filePath(folderDir.dirName() + QLatin1String(".lnk"));
|
||||
QString links = QDir::fromNativeSeparators(QString::fromWCharArray(path));
|
||||
linkName = QDir(links).filePath(folderDir.dirName() + QLatin1String(".lnk"));
|
||||
}
|
||||
} else {
|
||||
/* Use legacy functions */
|
||||
|
|
Loading…
Reference in a new issue