Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b8cbd8bd
Commit
b8cbd8bd
authored
Mar 11, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Mar 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Use xdg well known directories for desktop folder symbolic link.
parent
78f5db2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
shellpath.c
dlls/shell32/shellpath.c
+13
-6
No files found.
dlls/shell32/shellpath.c
View file @
b8cbd8bd
...
@@ -1997,15 +1997,16 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
...
@@ -1997,15 +1997,16 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
* shell folder to it. But if not, then we check XDG_MUSIC_DIR - "well known"
* 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
* directory, and try to link to that. If that fails, then we symlink to
* $HOME directly. The same holds fo 'My Pictures' and 'My Video'.
* $HOME directly. The same holds fo 'My Pictures' and 'My Video'.
* - The Desktop shell folder is symlinked to '$HOME/Desktop', if that does
* - The Desktop shell folder is symlinked to XDG_DESKTOP_DIR. If that does not
* exists and left alone if 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))
* ('My Music',... above in fact means LoadString(IDS_MYMUSIC))
*/
*/
static
void
_SHCreateSymbolicLinks
(
void
)
static
void
_SHCreateSymbolicLinks
(
void
)
{
{
UINT
aidsMyStuff
[]
=
{
IDS_MYPICTURES
,
IDS_MYVIDEO
,
IDS_MYMUSIC
},
i
;
UINT
aidsMyStuff
[]
=
{
IDS_MYPICTURES
,
IDS_MYVIDEO
,
IDS_MYMUSIC
},
i
;
int
acsidlMyStuff
[]
=
{
CSIDL_MYPICTURES
,
CSIDL_MYVIDEO
,
CSIDL_MYMUSIC
};
int
acsidlMyStuff
[]
=
{
CSIDL_MYPICTURES
,
CSIDL_MYVIDEO
,
CSIDL_MYMUSIC
};
static
const
char
*
xdg_dirs
[]
=
{
"PICTURES"
,
"VIDEOS"
,
"MUSIC"
};
static
const
char
*
xdg_dirs
[]
=
{
"PICTURES"
,
"VIDEOS"
,
"MUSIC"
,
"DESKTOP"
};
WCHAR
wszTempPath
[
MAX_PATH
];
WCHAR
wszTempPath
[
MAX_PATH
];
char
szPersonalTarget
[
FILENAME_MAX
],
*
pszPersonal
;
char
szPersonalTarget
[
FILENAME_MAX
],
*
pszPersonal
;
char
szMyStuffTarget
[
FILENAME_MAX
],
*
pszMyStuff
;
char
szMyStuffTarget
[
FILENAME_MAX
],
*
pszMyStuff
;
...
@@ -2015,6 +2016,7 @@ static void _SHCreateSymbolicLinks(void)
...
@@ -2015,6 +2016,7 @@ static void _SHCreateSymbolicLinks(void)
HRESULT
hr
;
HRESULT
hr
;
const
unsigned
int
num
=
sizeof
(
xdg_dirs
)
/
sizeof
(
xdg_dirs
[
0
]);
const
unsigned
int
num
=
sizeof
(
xdg_dirs
)
/
sizeof
(
xdg_dirs
[
0
]);
char
**
xdg_results
=
NULL
;
char
**
xdg_results
=
NULL
;
char
*
xdg_desktop_dir
;
/* Create all necessary profile sub-dirs up to 'My Documents' and get the unix path. */
/* Create all necessary profile sub-dirs up to 'My Documents' and get the unix path. */
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_PERSONAL
|
CSIDL_FLAG_CREATE
,
NULL
,
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_PERSONAL
|
CSIDL_FLAG_CREATE
,
NULL
,
...
@@ -2102,15 +2104,20 @@ static void _SHCreateSymbolicLinks(void)
...
@@ -2102,15 +2104,20 @@ static void _SHCreateSymbolicLinks(void)
strcpy
(
szDesktopTarget
,
pszPersonal
);
strcpy
(
szDesktopTarget
,
pszPersonal
);
HeapFree
(
GetProcessHeap
(),
0
,
pszPersonal
);
HeapFree
(
GetProcessHeap
(),
0
,
pszPersonal
);
if
(
_SHAppendToUnixPath
(
szDesktopTarget
,
DesktopW
)
&&
xdg_desktop_dir
=
xdg_results
?
xdg_results
[
num
-
1
]
:
NULL
;
!
stat
(
szDesktopTarget
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
if
(
xdg_desktop_dir
||
(
_SHAppendToUnixPath
(
szDesktopTarget
,
DesktopW
)
&&
!
stat
(
szDesktopTarget
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
)))
{
{
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_DESKTOPDIRECTORY
|
CSIDL_FLAG_CREATE
,
NULL
,
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_DESKTOPDIRECTORY
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_DEFAULT
,
wszTempPath
);
SHGFP_TYPE_DEFAULT
,
wszTempPath
);
if
(
SUCCEEDED
(
hr
)
&&
(
pszDesktop
=
wine_get_unix_file_name
(
wszTempPath
)))
if
(
SUCCEEDED
(
hr
)
&&
(
pszDesktop
=
wine_get_unix_file_name
(
wszTempPath
)))
{
{
rmdir
(
pszDesktop
);
rmdir
(
pszDesktop
);
symlink
(
szDesktopTarget
,
pszDesktop
);
if
(
xdg_desktop_dir
)
symlink
(
xdg_desktop_dir
,
pszDesktop
);
else
symlink
(
szDesktopTarget
,
pszDesktop
);
HeapFree
(
GetProcessHeap
(),
0
,
pszDesktop
);
HeapFree
(
GetProcessHeap
(),
0
,
pszDesktop
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment