[Pkg-owncloud-commits] [owncloud-client] 462/498: Revert "Use dynamic library loading for detecting the correct path for links"

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Aug 11 14:49:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit a9858d4ed2cde54fc1cda072e0bd49ce65c4de34
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date:   Thu Aug 6 10:41:33 2015 +0200

    Revert "Use dynamic library loading for detecting the correct path for links"
---
 src/libsync/utility_win.cpp | 42 ++++--------------------------------------
 1 file changed, 4 insertions(+), 38 deletions(-)

diff --git a/src/libsync/utility_win.cpp b/src/libsync/utility_win.cpp
index 78cbe43..f450967 100644
--- a/src/libsync/utility_win.cpp
+++ b/src/libsync/utility_win.cpp
@@ -14,53 +14,19 @@
 #include <shlobj.h>
 #include <winbase.h>
 #include <windows.h>
-#include <shlguid.h>
-#include <string>
-#include <QLibrary>
 
 static const char runPathC[] = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
 
-typedef HRESULT (WINAPI *SHGetKnownFolderPathFun)(
-    const GUID &rfid, 
-    DWORD dwFlags, 
-    HANDLE hToken, 
-    PWSTR *ppszPath
-);
-     
 static void setupFavLink_private(const QString &folder)
 {
     // Windows Explorer: Place under "Favorites" (Links)
-    
-    static SHGetKnownFolderPathFun SHGetKnownFolderPathPtr = NULL;
-    QString linkName; 
+    wchar_t path[MAX_PATH];
+    SHGetSpecialFolderPath(0, path, CSIDL_PROFILE, FALSE);
+    QString profile =  QDir::fromNativeSeparators(QString::fromWCharArray(path));
     QDir folderDir(QDir::fromNativeSeparators(folder));
-    if (!SHGetKnownFolderPathPtr)
-    {
-      QLibrary kernel32Lib("shell32.dll");
-      if(kernel32Lib.load())
-      {
-        SHGetKnownFolderPathPtr = (SHGetKnownFolderPathFun) kernel32Lib.resolve("SHGetKnownFolderPath");
-      }
-    }
-     
-    if(SHGetKnownFolderPathPtr) {
-        /* 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"));
-        }
-    } else {
-        /* Use legacy functions */
-        wchar_t path[MAX_PATH];
-        SHGetSpecialFolderPath(0, path, CSIDL_PROFILE, FALSE);
-        QString profile = QDir::fromNativeSeparators(QString::fromWCharArray(path));
-        linkName = QDir(profile).filePath(QDir(QLatin1String("Links")).filePath(folderDir.dirName() + QLatin1String(".lnk")));
-    }
-    qDebug() << Q_FUNC_INFO << " creating link from " << linkName << " to " << folder;
+    QString linkName = profile+QLatin1String("/Links/") + folderDir.dirName() + QLatin1String(".lnk");
     if (!QFile::link(folder, linkName))
         qDebug() << Q_FUNC_INFO << "linking" << folder << "to" << linkName << "failed!";
-
 }
 
 bool hasLaunchOnStartup_private(const QString &appName)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list