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
265c8a5d
Commit
265c8a5d
authored
Jan 19, 2006
by
Aric Stewart
Committed by
Alexandre Julliard
Jan 19, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Update shellpaths My Pictures, My Video, My Music to be under
$HOME, with a number of fallbacks.
parent
b645b9ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
22 deletions
+68
-22
shellpath.c
dlls/shell32/shellpath.c
+68
-22
No files found.
dlls/shell32/shellpath.c
View file @
265c8a5d
...
...
@@ -1229,6 +1229,66 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
return
hr
;
}
/* Helper function for _SHGetDefaultValue
*
* handing the directories under $HOME:
* 1) try path under $HOME (such as $HOME/My Documents/My Pictures), if it
* exists return it.
* 2) if not, but $HOME/My Documents exists return path 1 and have it created
* 3) try $HOME if it exists return it
* 4) normal fallback to C:/windows/Profiles/...
*/
static
HRESULT
expand_home_path
(
LPWSTR
pszPath
,
LPCWSTR
def_path
,
UINT
resource
,
BOOL
create_lastdir
)
{
HRESULT
hr
=
E_FAIL
;
const
char
*
home
=
getenv
(
"HOME"
);
if
(
home
)
{
LPWSTR
homeW
=
wine_get_dos_file_name
(
home
);
if
(
homeW
)
{
WCHAR
resourcePath
[
MAX_PATH
];
lstrcpynW
(
pszPath
,
homeW
,
MAX_PATH
);
if
(
LoadStringW
(
shell32_hInstance
,
resource
,
resourcePath
,
MAX_PATH
))
PathAppendW
(
pszPath
,
resourcePath
);
else
PathAppendW
(
pszPath
,
def_path
);
if
(
PathIsDirectoryW
(
pszPath
))
hr
=
S_OK
;
else
if
(
create_lastdir
)
{
/* attempt 2, try for My Documents */
WCHAR
*
ptr
=
strrchrW
(
pszPath
,
'\\'
);
if
(
ptr
)
{
*
ptr
=
0
;
if
(
PathIsDirectoryW
(
pszPath
))
{
*
ptr
=
'\\'
;
hr
=
S_OK
;
}
}
}
if
(
hr
!=
S_OK
)
{
/* attempt 3 return HOME */
lstrcpyW
(
pszPath
,
homeW
);
hr
=
S_OK
;
}
HeapFree
(
GetProcessHeap
(),
0
,
homeW
);
}
else
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
}
return
hr
;
}
/* Gets a 'semi-expanded' default value of the CSIDL with index folder into
* pszPath, based on the entries in CSIDL_Data. By semi-expanded, I mean:
* - The entry's szDefaultPath may be either a string value or an integer
...
...
@@ -1260,32 +1320,18 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
hr
=
E_FAIL
;
switch
(
folder
)
{
case
CSIDL_MYPICTURES
:
hr
=
expand_home_path
(
pszPath
,
My_PicturesW
,
IDS_MYPICTURES
,
TRUE
);
break
;
case
CSIDL_PERSONAL
:
hr
=
expand_home_path
(
pszPath
,
PersonalW
,
IDS_PERSONAL
,
FALSE
);
break
;
case
CSIDL_MYMUSIC
:
case
CSIDL_MYPICTURES
:
hr
=
expand_home_path
(
pszPath
,
My_MusicW
,
IDS_MYMUSIC
,
TRUE
);
break
;
case
CSIDL_MYVIDEO
:
{
const
char
*
home
=
getenv
(
"HOME"
);
/* special case for "My Documents", map to $HOME */
if
(
home
)
{
LPWSTR
homeW
=
wine_get_dos_file_name
(
home
);
if
(
homeW
)
{
if
(
PathIsDirectoryW
(
homeW
))
{
lstrcpynW
(
pszPath
,
homeW
,
MAX_PATH
);
hr
=
S_OK
;
}
HeapFree
(
GetProcessHeap
(),
0
,
homeW
);
}
else
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
}
hr
=
expand_home_path
(
pszPath
,
My_VideoW
,
IDS_MYVIDEO
,
TRUE
);
break
;
}
case
CSIDL_DESKTOP
:
case
CSIDL_DESKTOPDIRECTORY
:
{
...
...
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