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
e4c285b0
Commit
e4c285b0
authored
Apr 03, 2015
by
Francois Gouget
Committed by
Alexandre Julliard
Apr 03, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Point the 'My Documents' symbolic link to the XDG or OS X 'Documents'…
shell32: Point the 'My Documents' symbolic link to the XDG or OS X 'Documents' folder if they exist.
parent
d46e6fe6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
15 deletions
+39
-15
shellpath.c
dlls/shell32/shellpath.c
+39
-15
No files found.
dlls/shell32/shellpath.c
View file @
e4c285b0
...
...
@@ -2786,7 +2786,7 @@ static void _SHCreateSymbolicLinks(void)
{
UINT
aidsMyStuff
[]
=
{
IDS_MYPICTURES
,
IDS_MYVIDEOS
,
IDS_MYMUSIC
},
i
;
int
acsidlMyStuff
[]
=
{
CSIDL_MYPICTURES
,
CSIDL_MYVIDEO
,
CSIDL_MYMUSIC
};
static
const
char
*
const
xdg_dirs
[]
=
{
"PICTURES"
,
"VIDEOS"
,
"MUSIC"
,
"DESKTOP"
};
static
const
char
*
const
xdg_dirs
[]
=
{
"PICTURES"
,
"VIDEOS"
,
"MUSIC"
,
"D
OCUMENTS"
,
"D
ESKTOP"
};
static
const
unsigned
int
num
=
sizeof
(
xdg_dirs
)
/
sizeof
(
xdg_dirs
[
0
]);
WCHAR
wszTempPath
[
MAX_PATH
];
char
szPersonalTarget
[
FILENAME_MAX
],
*
pszPersonal
;
...
...
@@ -2809,23 +2809,47 @@ static void _SHCreateSymbolicLinks(void)
if
(
FAILED
(
hr
))
xdg_results
=
NULL
;
pszHome
=
getenv
(
"HOME"
);
if
(
pszHome
&&
!
stat
(
pszHome
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
{
strcpy
(
szPersonalTarget
,
pszHome
);
if
(
_SHAppendToUnixPath
(
szPersonalTarget
,
MAKEINTRESOURCEW
(
IDS_PERSONAL
))
&&
!
stat
(
szPersonalTarget
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
if
(
pszHome
&&
!
stat
(
pszHome
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
{
while
(
1
)
{
/* '$HOME/My Documents' exists. Create 'My Pictures', 'My Videos' and
* 'My Music' subfolders or fail silently if they already exist. */
for
(
i
=
0
;
i
<
sizeof
(
aidsMyStuff
)
/
sizeof
(
aidsMyStuff
[
0
]);
i
++
)
{
strcpy
(
szMyStuffTarget
,
szPersonalTarget
);
if
(
_SHAppendToUnixPath
(
szMyStuffTarget
,
MAKEINTRESOURCEW
(
aidsMyStuff
[
i
])))
mkdir
(
szMyStuffTarget
,
0777
);
/* Check if there's already a Wine-specific 'My Documents' folder */
strcpy
(
szPersonalTarget
,
pszHome
);
if
(
_SHAppendToUnixPath
(
szPersonalTarget
,
MAKEINTRESOURCEW
(
IDS_PERSONAL
))
&&
!
stat
(
szPersonalTarget
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
{
/* '$HOME/My Documents' exists. Create 'My Pictures',
* 'My Videos' and 'My Music' subfolders or fail silently if
* they already exist.
*/
for
(
i
=
0
;
i
<
sizeof
(
aidsMyStuff
)
/
sizeof
(
*
aidsMyStuff
);
i
++
)
{
strcpy
(
szMyStuffTarget
,
szPersonalTarget
);
if
(
_SHAppendToUnixPath
(
szMyStuffTarget
,
MAKEINTRESOURCEW
(
aidsMyStuff
[
i
])))
mkdir
(
szMyStuffTarget
,
0777
);
}
break
;
}
}
else
{
/* '$HOME/My Documents' doesn't exists, but '$HOME' does. */
/* Try to point to the XDG Documents folder */
if
(
xdg_results
&&
xdg_results
[
num
-
2
]
&&
!
stat
(
xdg_results
[
num
-
2
],
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
{
strcpy
(
szPersonalTarget
,
xdg_results
[
num
-
2
]);
break
;
}
/* Or the hardcoded / OS X Documents folder */
strcpy
(
szPersonalTarget
,
pszHome
);
if
(
_SHAppendToUnixPath
(
szPersonalTarget
,
DocumentsW
)
&&
!
stat
(
szPersonalTarget
,
&
statFolder
)
&&
S_ISDIR
(
statFolder
.
st_mode
))
break
;
/* As a last resort point to $HOME. */
strcpy
(
szPersonalTarget
,
pszHome
);
break
;
}
/* Replace 'My Documents' directory with a symlink or fail silently if not empty. */
...
...
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