Skip to content

Commit

Permalink
Windows: Make sure that the folder and Desktop.ini have the right att…
Browse files Browse the repository at this point in the history
…ributes (#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
  • Loading branch information
jturcotte authored Sep 11, 2017
1 parent 6f270a3 commit 2d7a4bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/common/utility_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2d7a4bd

Please sign in to comment.