From: Jocelyn Turcotte Date: Mon, 11 Sep 2017 13:32:42 +0000 (+0200) Subject: Windows: Make sure that the folder and Desktop.ini have the right attributes (#6018) X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~701^2~120 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bdf3f1e27135f4214185d767a2876616ff662380;p=nextcloud-desktop.git Windows: Make sure that the folder and Desktop.ini have the right attributes (#6018) When created from scratch, the owncloud icon won't be picked-up by explorer unless the right attributes are set on both the sync root and the Desktop.ini file. Issue #2446 --- diff --git a/src/common/utility_win.cpp b/src/common/utility_win.cpp index f7fef1019..5374b0986 100644 --- a/src/common/utility_win.cpp +++ b/src/common/utility_win.cpp @@ -43,6 +43,12 @@ static void setupFavLink_private(const QString &folder) desktopIni.write(QDir::toNativeSeparators(qApp->applicationFilePath()).toUtf8()); desktopIni.write(",0\r\n"); desktopIni.close(); + + // Set the folder as system and Desktop.ini as hidden+system for explorer to pick it. + // https://msdn.microsoft.com/en-us/library/windows/desktop/cc144102 + DWORD folderAttrs = GetFileAttributesW((wchar_t *)folder.utf16()); + SetFileAttributesW((wchar_t *)folder.utf16(), folderAttrs | FILE_ATTRIBUTE_SYSTEM); + SetFileAttributesW((wchar_t *)desktopIni.fileName().utf16(), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM); } // Windows Explorer: Place under "Favorites" (Links)