1 # git-gui desktop icon creators
2 # Copyright (C) 2006, 2007 Shawn Pearce
4 proc do_windows_shortcut
{} {
6 set fn
[tk_getSaveFile \
8 -title [append "[appname] ([reponame]): " [mc
"Create Desktop Icon"]] \
9 -initialfile "Git [reponame].lnk"]
11 if {[file extension
$fn] ne
{.lnk
}} {
15 win32_create_lnk
$fn [list \
16 [info nameofexecutable
] \
17 [file normalize
$::argv0] \
19 [file normalize
[$_gitworktree]]
21 error_popup
[strcat
[mc
"Cannot write shortcut:"] "\n\n$err"]
26 proc do_cygwin_shortcut
{} {
27 global argv0 _gitworktree
30 set desktop
[exec cygpath
\
38 set fn
[tk_getSaveFile \
40 -title [append "[appname] ([reponame]): " [mc
"Create Desktop Icon"]] \
41 -initialdir $desktop \
42 -initialfile "Git [reponame].lnk"]
44 if {[file extension
$fn] ne
{.lnk
}} {
48 set sh
[exec cygpath
\
52 set me
[exec cygpath
\
56 win32_create_lnk
$fn [list \
58 "CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
60 [file normalize
[$_gitworktree]]
62 error_popup
[strcat
[mc
"Cannot write shortcut:"] "\n\n$err"]
67 proc do_macosx_app
{} {
70 set fn
[tk_getSaveFile \
72 -title [append "[appname] ([reponame]): " [mc
"Create Desktop Icon"]] \
73 -initialdir [file join $env(HOME
) Desktop
] \
74 -initialfile "Git [reponame].app"]
76 if {[file extension
$fn] ne
{.app
}} {
80 set Contents
[file join $fn Contents
]
81 set MacOS
[file join $Contents MacOS
]
82 set exe
[file join $MacOS git-gui
]
86 set fd
[open [file join $Contents Info.plist
] w
]
87 puts $fd {<?xml version
="1.0" encoding="UTF-8"?
>
88 <!DOCTYPE plist PUBLIC
"-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
91 <key
>CFBundleDevelopmentRegion
</key
>
92 <string>English
</string>
93 <key
>CFBundleExecutable
</key
>
94 <string>git-gui
</string>
95 <key
>CFBundleIdentifier
</key
>
96 <string>org.spearce.git-gui
</string>
97 <key
>CFBundleInfoDictionaryVersion
</key
>
99 <key
>CFBundlePackageType
</key
>
100 <string>APPL
</string>
101 <key
>CFBundleSignature
</key
>
102 <string>????
</string>
103 <key
>CFBundleVersion
</key
>
105 <key
>NSPrincipalClass
</key
>
106 <string>NSApplication
</string>
113 foreach name
[lsort [array names env
]] {
114 set value
$env($name)
116 GIT_DIR
{ set value
[file normalize
[gitdir
]] }
119 switch -glob -- $name {
122 puts $fd "if test \"z\$$name\" = z; then"
123 puts $fd " export $name=[sq $value]"
128 puts $fd "export PATH=[sq [file dirname $::_git]]:\$PATH &&"
129 puts $fd "cd [sq [file normalize [pwd]]] &&"
131 puts $fd " [sq [info nameofexecutable]] \\"
132 puts $fd " [sq [file normalize $argv0]]"
135 file attributes
$exe -permissions u
+x
,g
+x
,o
+x
137 error_popup
[strcat
[mc
"Cannot write icon:"] "\n\n$err"]