The fall-back target path, 'pszPersonal' (base)+'DesktopW' (offset), will point to:
'%USERPROFILE%\Documents\Desktop'
Wine does not create this directory. So this code path is clearly invalid, as this symlink will never be created. Refactor this block to make it consistent with the other 2 (preceding) blocks.
Signed-off-by: Rob Walker bob.mt.wya@gmail.com --- dlls/shell32/shellpath.c | 48 ++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-)
diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index cf4d9ffbd0..faa8c892e9 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -4423,7 +4423,6 @@ static void _SHCreateSymbolicLinks(void) HRESULT hr; BOOL target_ok; char ** xdg_results; - char * xdg_desktop_dir;
/* Create the '%USERPROFILE%\My Documents' directory path. */ hr = SHGetFolderPathW(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, @@ -4470,6 +4469,8 @@ static void _SHCreateSymbolicLinks(void) remove(pszPersonal); symlink(szPersonalTarget, pszPersonal); } + + heap_free(pszPersonal); }
/* Create symbolic links for 'My Pictures', 'My Videos' and 'My Music'. */ @@ -4515,28 +4516,37 @@ static void _SHCreateSymbolicLinks(void) heap_free(pszMyStuff); }
- /* Create a symbolic link for the 'Desktop' folder. */ - if (pszHome) - strcpy(szDesktopTarget, pszHome); - else - strcpy(szDesktopTarget, pszPersonal); - heap_free(pszPersonal); - - xdg_desktop_dir = xdg_results ? xdg_results[num - 1] : NULL; - if (xdg_desktop_dir || - (_SHAppendToUnixPath(szDesktopTarget, DesktopW) && - !stat(szDesktopTarget, &statFolder) && S_ISDIR(statFolder.st_mode))) - { - /* Get the '%USERPROFILE%\Desktop' directory path. */ - hr = SHGetFolderPathW(NULL, CSIDL_DESKTOPDIRECTORY|CSIDL_FLAG_CREATE, NULL, + /* Get the '%USERPROFILE%\Desktop' directory path. */ + hr = SHGetFolderPathW(NULL, CSIDL_DESKTOPDIRECTORY|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_DEFAULT, wszTempPath); - if (SUCCEEDED(hr) && (pszDesktop = wine_get_unix_file_name(wszTempPath))) + if (SUCCEEDED(hr) && pszHome) + { + /* Create a symbolic link for the 'Desktop' folder. */ + pszDesktop = wine_get_unix_file_name(wszTempPath); + if (pszDesktop) { - remove(pszDesktop); - if (xdg_desktop_dir) - symlink(xdg_desktop_dir, pszDesktop); + strcpy(szDesktopTarget, pszHome); + i = num - 1; + /* Try to target the XDG_DESKTOP_DIR folder. */ + if (xdg_results && xdg_results[i]) + { + strcpy(szDesktopTarget, xdg_results[i]); + target_ok = TRUE; + } + /* Try to target the hardcoded / OS X 'Desktop' folder. */ else + { + strcpy(szDesktopTarget, pszHome); + target_ok = _SHAppendToUnixPath(szDesktopTarget, DesktopW) + && !stat(szDesktopTarget, &statFolder) + && S_ISDIR(statFolder.st_mode); + } + + if (target_ok) + { + remove(pszDesktop); symlink(szDesktopTarget, pszDesktop); + } heap_free(pszDesktop); } }