From 9cb47e882123dfdbc0f93ef0d7fb0068edda80d0 Mon Sep 17 00:00:00 2001 From: "Olivier F. R. Dierick" Date: Wed, 19 Feb 2020 00:16:43 +0100 Subject: [PATCH] shell32: Add a function to create one specific symbolic link at a time for user dirs. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=22974 Signed-off-by: Olivier F. R. Dierick Signed-off-by: Alexandre Julliard --- dlls/shell32/shellpath.c | 46 ++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 2012ecbe352..d32529bae3e 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -4326,6 +4326,39 @@ static void _SHCreateDesktopSymbolicLink(void) _SHFreeXDGUserDirs(num, xdg_results); } +/****************************************************************************** + * _SHCreateSymbolicLink [Internal] + * + * Sets up a symbolic link for one of the special shell folders to point into + * the users home directory. + * + * PARAMS + * nFolder [I] CSIDL identifying the folder. + */ +static void _SHCreateSymbolicLink(int nFolder) +{ + static const UINT aidsMyStuff[] = { + IDS_MYPICTURES, IDS_MYVIDEOS, IDS_MYMUSIC, IDS_DOWNLOADS, IDS_TEMPLATES + }; + DWORD folder = nFolder & CSIDL_FOLDER_MASK; + + switch (folder) { + case CSIDL_PERSONAL: + _SHCreateMyDocumentsSymbolicLink(aidsMyStuff, ARRAY_SIZE(aidsMyStuff)); + break; + case CSIDL_MYPICTURES: + case CSIDL_MYVIDEO: + case CSIDL_MYMUSIC: + case CSIDL_DOWNLOADS: + case CSIDL_TEMPLATES: + _SHCreateMyStuffSymbolicLink(folder); + break; + case CSIDL_DESKTOPDIRECTORY: + _SHCreateDesktopSymbolicLink(); + break; + } +} + /****************************************************************************** * _SHCreateSymbolicLinks [Internal] * @@ -4351,22 +4384,13 @@ static void _SHCreateDesktopSymbolicLink(void) */ static void _SHCreateSymbolicLinks(void) { - static const UINT aidsMyStuff[] = { - IDS_MYPICTURES, IDS_MYVIDEOS, IDS_MYMUSIC, IDS_DOWNLOADS, IDS_TEMPLATES - }; static const int acsidlMyStuff[] = { - CSIDL_MYPICTURES, CSIDL_MYVIDEO, CSIDL_MYMUSIC, CSIDL_DOWNLOADS, CSIDL_TEMPLATES + CSIDL_MYPICTURES, CSIDL_MYVIDEO, CSIDL_MYMUSIC, CSIDL_DOWNLOADS, CSIDL_TEMPLATES, CSIDL_PERSONAL, CSIDL_DESKTOPDIRECTORY }; UINT i; - _SHCreateMyDocumentsSymbolicLink(aidsMyStuff, ARRAY_SIZE(aidsMyStuff)); - - /* Create symbolic links for 'My Pictures', 'My Videos', 'My Music' etc. */ for (i=0; i < ARRAY_SIZE(acsidlMyStuff); i++) - _SHCreateMyStuffSymbolicLink(acsidlMyStuff[i]); - - /* Last but not least, the Desktop folder */ - _SHCreateDesktopSymbolicLink(); + _SHCreateSymbolicLink(acsidlMyStuff[i]); } /******************************************************************************