1 # git-gui desktop icon creators
2 # Copyright (C) 2006, 2007 Shawn Pearce
4 proc do_windows_shortcut
{} {
5 set fn
[tk_getSaveFile \
7 -title [append "[appname] ([reponame]): " [mc
"Create Desktop Icon"]] \
8 -initialfile "Git [reponame].lnk"]
10 if {[file extension
$fn] ne
{.lnk
}} {
14 win32_create_lnk
$fn [list \
15 [info nameofexecutable
] \
16 [file normalize
$::argv0] \
18 [file dirname
[file normalize
[gitdir
]]]
20 error_popup
[strcat
[mc
"Cannot write shortcut:"] "\n\n$err"]
25 proc do_cygwin_shortcut
{} {
29 set desktop
[exec cygpath
\
37 set fn
[tk_getSaveFile \
39 -title [append "[appname] ([reponame]): " [mc
"Create Desktop Icon"]] \
40 -initialdir $desktop \
41 -initialfile "Git [reponame].lnk"]
43 if {[file extension
$fn] ne
{.lnk
}} {
47 set sh
[exec cygpath
\
51 set me
[exec cygpath
\
55 win32_create_lnk
$fn [list \
57 "CHERE_INVOKING=1 source /etc/profile;[sq $me]" \
59 [file dirname
[file normalize
[gitdir
]]]
61 error_popup
[strcat
[mc
"Cannot write shortcut:"] "\n\n$err"]
66 proc do_macosx_app
{} {
69 set fn
[tk_getSaveFile \
71 -title [append "[appname] ([reponame]): " [mc
"Create Desktop Icon"]] \
72 -initialdir [file join $env(HOME
) Desktop
] \
73 -initialfile "Git [reponame].app"]
75 if {[file extension
$fn] ne
{.app
}} {
79 set Contents
[file join $fn Contents
]
80 set MacOS
[file join $Contents MacOS
]
81 set exe
[file join $MacOS git-gui
]
85 set fd
[open [file join $Contents Info.plist
] w
]
86 puts $fd {<?xml version
="1.0" encoding="UTF-8"?
>
87 <!DOCTYPE plist PUBLIC
"-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
90 <key
>CFBundleDevelopmentRegion
</key
>
91 <string>English
</string>
92 <key
>CFBundleExecutable
</key
>
93 <string>git-gui
</string>
94 <key
>CFBundleIdentifier
</key
>
95 <string>org.spearce.git-gui
</string>
96 <key
>CFBundleInfoDictionaryVersion
</key
>
98 <key
>CFBundlePackageType
</key
>
100 <key
>CFBundleSignature
</key
>
101 <string>????
</string>
102 <key
>CFBundleVersion
</key
>
104 <key
>NSPrincipalClass
</key
>
105 <string>NSApplication
</string>
112 foreach name
[lsort [array names env
]] {
113 set value
$env($name)
115 GIT_DIR
{ set value
[file normalize
[gitdir
]] }
118 switch -glob -- $name {
121 puts $fd "if test \"z\$$name\" = z; then"
122 puts $fd " export $name=[sq $value]"
127 puts $fd "export PATH=[sq [file dirname $::_git]]:\$PATH &&"
128 puts $fd "cd [sq [file normalize [pwd]]] &&"
130 puts $fd " [sq [info nameofexecutable]] \\"
131 puts $fd " [sq [file normalize $argv0]]"
134 file attributes
$exe -permissions u
+x
,g
+x
,o
+x
136 error_popup
[strcat
[mc
"Cannot write icon:"] "\n\n$err"]