Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
78f5db2b
Commit
78f5db2b
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 my_xxx folder symbolic links.
parent
f5ba1c21
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
shellpath.c
dlls/shell32/shellpath.c
+26
-3
No files found.
dlls/shell32/shellpath.c
View file @
78f5db2b
...
...
@@ -46,6 +46,7 @@
#include "pidl.h"
#include "wine/unicode.h"
#include "shlwapi.h"
#include "xdg.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
shell
);
...
...
@@ -1993,8 +1994,9 @@ static inline BOOL _SHAppendToUnixPath(char *szBasePath, LPCWSTR pwszSubPath) {
* 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, we symlink it to $HOME directly. The same
* holds fo 'My Pictures' and 'My Video'.
* 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 Video'.
* - The Desktop shell folder is symlinked to '$HOME/Desktop', if that does
* exists and left alone if not.
* ('My Music',... above in fact means LoadString(IDS_MYMUSIC))
...
...
@@ -2003,6 +2005,7 @@ static void _SHCreateSymbolicLinks(void)
{
UINT
aidsMyStuff
[]
=
{
IDS_MYPICTURES
,
IDS_MYVIDEO
,
IDS_MYMUSIC
},
i
;
int
acsidlMyStuff
[]
=
{
CSIDL_MYPICTURES
,
CSIDL_MYVIDEO
,
CSIDL_MYMUSIC
};
static
const
char
*
xdg_dirs
[]
=
{
"PICTURES"
,
"VIDEOS"
,
"MUSIC"
};
WCHAR
wszTempPath
[
MAX_PATH
];
char
szPersonalTarget
[
FILENAME_MAX
],
*
pszPersonal
;
char
szMyStuffTarget
[
FILENAME_MAX
],
*
pszMyStuff
;
...
...
@@ -2010,6 +2013,8 @@ static void _SHCreateSymbolicLinks(void)
struct
stat
statFolder
;
const
char
*
pszHome
;
HRESULT
hr
;
const
unsigned
int
num
=
sizeof
(
xdg_dirs
)
/
sizeof
(
xdg_dirs
[
0
]);
char
**
xdg_results
=
NULL
;
/* Create all necessary profile sub-dirs up to 'My Documents' and get the unix path. */
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_PERSONAL
|
CSIDL_FLAG_CREATE
,
NULL
,
...
...
@@ -2018,6 +2023,8 @@ static void _SHCreateSymbolicLinks(void)
pszPersonal
=
wine_get_unix_file_name
(
wszTempPath
);
if
(
!
pszPersonal
)
return
;
XDG_UserDirLookup
(
xdg_dirs
,
num
,
&
xdg_results
);
pszHome
=
getenv
(
"HOME"
);
if
(
pszHome
&&
!
stat
(
pszHome
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
{
strcpy
(
szPersonalTarget
,
pszHome
);
...
...
@@ -2073,10 +2080,18 @@ static void _SHCreateSymbolicLinks(void)
}
else
{
/* Else link to where 'My Documents' itself links to. */
rmdir
(
pszMyStuff
);
if
(
xdg_results
&&
xdg_results
[
i
])
{
/* the folder specified by XDG_XXX_DIR exists, link to it. */
symlink
(
xdg_results
[
i
],
pszMyStuff
);
}
else
{
/* Else link to where 'My Documents' itself links to. */
symlink
(
szPersonalTarget
,
pszMyStuff
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
pszMyStuff
);
}
...
...
@@ -2099,6 +2114,14 @@ static void _SHCreateSymbolicLinks(void)
HeapFree
(
GetProcessHeap
(),
0
,
pszDesktop
);
}
}
/* Free resources allocated by XDG_UserDirLookup() */
if
(
xdg_results
)
{
for
(
i
=
0
;
i
<
num
;
i
++
)
HeapFree
(
GetProcessHeap
(),
0
,
xdg_results
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
xdg_results
);
}
}
/* Register the default values in the registry, as some apps seem to depend
...
...
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