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
f5b8bad2
Commit
f5b8bad2
authored
Nov 08, 2008
by
Damjan Jovanovic
Committed by
Alexandre Julliard
Nov 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemenubuilder: Generate desktop files instead of wineshelllink.
parent
b65d7683
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
6 deletions
+53
-6
winemenubuilder.c
programs/winemenubuilder/winemenubuilder.c
+53
-6
No files found.
programs/winemenubuilder/winemenubuilder.c
View file @
f5b8bad2
...
...
@@ -786,6 +786,37 @@ static char *extract_icon( LPCWSTR path, int index, BOOL bWait )
return
xpm_path
;
}
static
BOOL
write_desktop_entry
(
const
char
*
location
,
const
char
*
linkname
,
const
char
*
path
,
const
char
*
args
,
const
char
*
descr
,
const
char
*
workdir
,
const
char
*
icon
)
{
FILE
*
file
;
WINE_TRACE
(
"(%s,%s,%s,%s,%s,%s,%s)
\n
"
,
wine_dbgstr_a
(
location
),
wine_dbgstr_a
(
linkname
),
wine_dbgstr_a
(
path
),
wine_dbgstr_a
(
args
),
wine_dbgstr_a
(
descr
),
wine_dbgstr_a
(
workdir
),
wine_dbgstr_a
(
icon
));
file
=
fopen
(
location
,
"w"
);
if
(
file
==
NULL
)
return
FALSE
;
fprintf
(
file
,
"[Desktop Entry]
\n
"
);
fprintf
(
file
,
"Name=%s
\n
"
,
linkname
);
fprintf
(
file
,
"Exec=env WINEPREFIX=
\"
%s
\"
wine
\"
%s
\"
%s
\n
"
,
wine_get_config_dir
(),
path
,
args
);
fprintf
(
file
,
"Type=Application
\n
"
);
fprintf
(
file
,
"StartupWMClass=Wine
\n
"
);
if
(
descr
&&
lstrlenA
(
descr
))
fprintf
(
file
,
"Comment=%s
\n
"
,
descr
);
if
(
workdir
&&
lstrlenA
(
workdir
))
fprintf
(
file
,
"Path=%s
\n
"
,
workdir
);
if
(
icon
&&
lstrlenA
(
icon
))
fprintf
(
file
,
"Icon=%s
\n
"
,
icon
);
fclose
(
file
);
return
TRUE
;
}
/* This escapes \ in filenames */
static
LPSTR
escape
(
LPCWSTR
arg
)
{
...
...
@@ -1204,8 +1235,7 @@ static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bWait )
escaped_args
=
escape
(
szArgs
);
escaped_description
=
escape
(
szDescription
);
/* running multiple instances of wineshelllink
at the same time may be dangerous */
/* building multiple menus concurrently has race conditions */
hsem
=
CreateSemaphoreA
(
NULL
,
1
,
1
,
"winemenubuilder_semaphore"
);
if
(
WAIT_OBJECT_0
!=
MsgWaitForMultipleObjects
(
1
,
&
hsem
,
FALSE
,
INFINITE
,
QS_ALLINPUT
)
)
{
...
...
@@ -1213,9 +1243,26 @@ static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bWait )
goto
cleanup
;
}
r
=
fork_and_wait
(
"wineshelllink"
,
link_name
,
escaped_path
,
in_desktop_dir
(
csidl
),
escaped_args
,
icon_name
,
work_dir
?
work_dir
:
""
,
escaped_description
);
if
(
in_desktop_dir
(
csidl
))
{
char
*
location
;
const
char
*
lastEntry
;
lastEntry
=
strrchr
(
link_name
,
'/'
);
if
(
lastEntry
==
NULL
)
lastEntry
=
link_name
;
else
++
lastEntry
;
location
=
heap_printf
(
"%s/Desktop/%s.desktop"
,
getenv
(
"HOME"
),
lastEntry
);
if
(
location
)
{
r
=
!
write_desktop_entry
(
location
,
lastEntry
,
escaped_path
,
escaped_args
,
escaped_description
,
work_dir
,
icon_name
);
HeapFree
(
GetProcessHeap
(),
0
,
location
);
}
}
else
r
=
fork_and_wait
(
"wineshelllink"
,
link_name
,
escaped_path
,
0
,
escaped_args
,
icon_name
,
work_dir
?
work_dir
:
""
,
escaped_description
);
ReleaseSemaphore
(
hsem
,
1
,
NULL
);
...
...
@@ -1229,7 +1276,7 @@ cleanup:
HeapFree
(
GetProcessHeap
(),
0
,
escaped_description
);
if
(
r
&&
!
bWait
)
WINE_ERR
(
"failed to
fork and exec wineshelllink
\n
"
);
WINE_ERR
(
"failed to
build the menu
\n
"
);
return
(
r
==
0
);
}
...
...
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