[PATCH 09/11] shell32: Migrate User Profile media directories to the newer default Windows naming scheme

Rob Walker bob.mt.wya at gmail.com
Mon Jul 16 17:47:03 CDT 2018


Windows Vista (and newer releases), default to a flat USER PROFILE model of the form:

Personal='%USERPROFILE%\\Documents'
My Music='%USERPROFILE%\\Music'
My Pictures='%USERPROFILE%\\Pictures'
My Videos='%USERPROFILE%\\Videos'

Update _SHCreateSymbolicLinks() description (comment).
Update SHELL_RegisterShellFolders() comment.

Signed-off-by: Rob Walker <bob.mt.wya at gmail.com>
---
 dlls/shell32/shell32.rc  |  8 +++---
 dlls/shell32/shellpath.c | 58 +++++++++++++++++++++-------------------
 2 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/dlls/shell32/shell32.rc b/dlls/shell32/shell32.rc
index 084b052978..b2f91df5ed 100644
--- a/dlls/shell32/shell32.rc
+++ b/dlls/shell32/shell32.rc
@@ -200,12 +200,12 @@ the folder?"
         /* shell folder path default values */
 	/* FIXME: Some will be unused until desktop.ini support is implemented */
 	IDS_PROGRAMS                "Programs"
-	IDS_PERSONAL                "My Documents"
+	IDS_PERSONAL                "Documents"
 	IDS_FAVORITES               "Favorites"
 	IDS_STARTUP                 "StartUp"
 	IDS_STARTMENU               "Start Menu"
-	IDS_MYMUSIC                 "My Music"
-	IDS_MYVIDEOS                "My Videos"
+	IDS_MYMUSIC                 "Music"
+	IDS_MYVIDEOS                "Videos"
 	IDS_DESKTOPDIRECTORY        "#msgctxt#directory#Desktop"
 	IDS_NETHOOD                 "NetHood"
 	IDS_TEMPLATES               "Templates"
@@ -213,7 +213,7 @@ the folder?"
 	IDS_HISTORY                 "History"
 	IDS_PROGRAM_FILES           "Program Files"
 	IDS_PROGRAM_FILESX86        "Program Files (x86)"
-	IDS_MYPICTURES              "My Pictures"
+	IDS_MYPICTURES              "Pictures"
 	IDS_COMMON_FILES            "Common Files"
 	IDS_COMMON_DOCUMENTS        "Documents"
 	IDS_ADMINTOOLS              "Administrative Tools"
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index d7ddfaf26d..5bf027f6f2 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -4353,13 +4353,13 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
                     lstrcpyW(wszSubPath, DocumentsW);
                     break;
                 case IDS_MYMUSIC:
-                    lstrcpyW(wszSubPath, My_MusicW);
+                    lstrcpyW(wszSubPath, MusicW);
                     break;
                 case IDS_MYPICTURES:
-                    lstrcpyW(wszSubPath, My_PicturesW);
+                    lstrcpyW(wszSubPath, PicturesW);
                     break;
                 case IDS_MYVIDEOS:
-                    lstrcpyW(wszSubPath, My_VideosW);
+                    lstrcpyW(wszSubPath, VideosW);
                     break;
                 default:
                     ERR("LoadString(%d) failed!\n", LOWORD(pwszSubPath));
@@ -4386,26 +4386,21 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
 
 /******************************************************************************
  * _SHCreateSymbolicLinks  [Internal]
- * 
- * Sets up symbol links for various shell folders to point into the users home
- * directory. We do an educated guess about what the user would probably want:
- * - If there is a 'My Documents' directory in $HOME, the user probably wants
- *   wine's 'My Documents' to point there. Furthermore, we imply that the user
- *   is a Windows lover and has no problem with wine creating 'My Pictures',
- *   'My Music' and 'My Videos' subfolders under '$HOME/My Documents', if those
- *   do not already exits. We put appropriate symbolic links in place for those,
- *   too.
- * - If there is no 'My Documents' directory in $HOME, we let 'My Documents'
- *   point directly to $HOME. We assume the user to be a unix hacker who does not
- *   want wine to create anything anywhere besides the .wine directory. So, if
- *   there already is a 'My Music' directory in $HOME, we symlink the 'My Music'
- *   shell folder to it. But if not, then we check XDG_MUSIC_DIR - "well known"
- *   directory, and try to link to that. If that fails, then we symlink to
- *   $HOME directly. The same holds fo 'My Pictures' and 'My Videos'.
- * - The Desktop shell folder is symlinked to XDG_DESKTOP_DIR. If that does not
- *   exist, then we try '$HOME/Desktop'. If that does not exist, then we leave
- *   it alone.
- * ('My Music',... above in fact means LoadString(IDS_MYMUSIC))
+ *
+ * Creates a set of symbolic links from the current Wineprefix to the current
+ * user $HOME subdirectory (if this is set in the shell env).
+ *
+ * For each User Profile directory XXX in
+ *     'Documents', 'Music', 'Pictures', 'Movies', 'Desktop':
+ *
+ *  1) Create the '%USERPROFILE%\\XXX' User Profile directory
+ *     (in the current Wineprefix).
+ *  2) Create a symbolic link from the '%USERPROFILE%\\XXX' User Profile directory
+ *     to:
+ *      Resource ID 'XXX'     - if '$HOME/XXX'    exists then target this.
+ *      XDG_XXX_DIR           - if '$XDG_XXX_DIR' exists then target this.
+ *      MacOS 'XXX' directory - if '$HOME/XXX'    exists then target this.
+ *
  */
 static void _SHCreateSymbolicLinks(void)
 {
@@ -6041,10 +6036,19 @@ HRESULT SHELL_RegisterShellFolders(void)
 {
     HRESULT hr;
 
-    /* Set up '$HOME' targeted symlinks for 'My Documents', 'My Pictures',
-     * 'My Videos', 'My Music' and 'Desktop' in advance, so that the
-     * _SHRegister*ShellFolders() functions will find everything nice and clean
-     * and thus will not attempt to create them in the profile directory. */
+    /* Pre-create and setup '$HOME' subdirectory targeted symlinks for:
+     *
+     *  '%USERPROFILE\\Documents'
+     *  '%USERPROFILE\\Music'
+     *  '%USERPROFILE\\Pictures',
+     *  '%USERPROFILE\\Videos'
+     *  '%USERPROFILE\\Desktop'
+     *
+     * User Profile directories.
+     *
+     * These User Profile directories must pre-exist when calling the:
+     *  _SHRegister*ShellFolders() functions.
+     */
     _SHCreateSymbolicLinks();
 
     hr = _SHRegisterUserShellFolders(TRUE);
-- 
2.18.0




More information about the wine-devel mailing list