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
f26b6631
Commit
f26b6631
authored
Jun 07, 2010
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Jun 08, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Also extract .lnk icons from file types.
parent
16973508
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+38
-0
No files found.
programs/winemenubuilder/winemenubuilder.c
View file @
f26b6631
...
...
@@ -172,6 +172,9 @@ static char *xdg_config_dir;
static
char
*
xdg_data_dir
;
static
char
*
xdg_desktop_dir
;
static
WCHAR
*
assoc_query
(
ASSOCSTR
assocStr
,
LPCWSTR
name
,
LPCWSTR
extra
);
static
char
*
extract_icon
(
LPCWSTR
path
,
int
index
,
const
char
*
destFilename
,
BOOL
bWait
);
/* Icon extraction routines
*
* FIXME: should use PrivateExtractIcons and friends
...
...
@@ -814,6 +817,39 @@ static int ExtractFromICO(LPCWSTR szFileName, char *szXPMFileName)
return
0
;
}
static
int
ExtractFromFileType
(
LPCWSTR
szFileName
,
char
*
szXPMFileName
)
{
int
ret
=
1
;
WCHAR
*
extension
;
WCHAR
*
icon
=
NULL
;
WCHAR
*
comma
;
int
index
=
0
;
char
*
output_path
=
NULL
;
extension
=
strrchrW
(
szFileName
,
'.'
);
if
(
extension
==
NULL
)
goto
end
;
icon
=
assoc_query
(
ASSOCSTR_DEFAULTICON
,
extension
,
NULL
);
if
(
icon
==
NULL
)
goto
end
;
comma
=
strrchrW
(
icon
,
','
);
if
(
comma
)
{
*
comma
=
0
;
index
=
atoiW
(
comma
+
1
);
}
output_path
=
extract_icon
(
icon
,
index
,
NULL
,
FALSE
);
if
(
output_path
)
ret
=
rename
(
output_path
,
szXPMFileName
);
end:
HeapFree
(
GetProcessHeap
(),
0
,
icon
);
HeapFree
(
GetProcessHeap
(),
0
,
output_path
);
return
ret
;
}
static
BOOL
create_default_icon
(
const
char
*
filename
,
const
char
*
comment
)
{
FILE
*
fXPM
;
...
...
@@ -1031,6 +1067,8 @@ static char *extract_icon( LPCWSTR path, int index, const char *destFilename, BO
sprintf
(
xpm_path
,
"%s/%04x_%s.png"
,
iconsdir
,
crc
,
ico_name
);
if
(
ExtractFromICO
(
path
,
xpm_path
))
goto
end
;
if
(
ExtractFromFileType
(
path
,
xpm_path
))
goto
end
;
if
(
!
bWait
)
{
if
(
destFilename
)
...
...
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