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 [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
9 -initialfile "Git [reponame].lnk"]
11 if {[file extension $fn] ne {.lnk}} {
14 # Use git-gui.exe if available (ie: git-for-windows)
15 set cmdLine [auto_execok git-gui.exe]
17 set cmdLine [list [info nameofexecutable] \
18 [file normalize $::argv0]]
21 win32_create_lnk $fn $cmdLine \
22 [file normalize $_gitworktree]
24 error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
29 proc do_cygwin_shortcut {} {
30 global argv0 _gitworktree
33 set desktop [exec cygpath \
41 set fn [tk_getSaveFile \
43 -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
44 -initialdir $desktop \
45 -initialfile "Git [reponame].lnk"]
47 if {[file extension $fn] ne {.lnk}} {
51 set sh [exec cygpath \
55 set me [exec cygpath \
59 win32_create_lnk $fn [list \
61 "CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
63 [file normalize $_gitworktree]
65 error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
70 proc do_macosx_app {} {
73 set fn [tk_getSaveFile \
75 -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
76 -initialdir [file join $env(HOME) Desktop] \
77 -initialfile "Git [reponame].app"]
79 if {[file extension $fn] ne {.app}} {
83 set Contents [file join $fn Contents]
84 set MacOS [file join $Contents MacOS]
85 set exe [file join $MacOS git-gui]
89 set fd [open [file join $Contents Info.plist] w]
90 puts $fd {<?xml version="1.0" encoding="UTF-8"?>
91 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
94 <key>CFBundleDevelopmentRegion</key>
95 <string>English</string>
96 <key>CFBundleExecutable</key>
97 <string>git-gui</string>
98 <key>CFBundleIdentifier</key>
99 <string>org.spearce.git-gui</string>
100 <key>CFBundleInfoDictionaryVersion</key>
102 <key>CFBundlePackageType</key>
103 <string>APPL</string>
104 <key>CFBundleSignature</key>
105 <string>????</string>
106 <key>CFBundleVersion</key>
108 <key>NSPrincipalClass</key>
109 <string>NSApplication</string>
116 foreach name [lsort [array names env]] {
117 set value $env($name)
119 GIT_DIR { set value [file normalize [gitdir]] }
122 switch -glob -- $name {
125 puts $fd "if test \"z\$$name\" = z; then"
126 puts $fd " export $name=[sq $value]"
131 puts $fd "export PATH=[sq [file dirname $::_git]]:\$PATH &&"
132 puts $fd "cd [sq [file normalize [pwd]]] &&"
134 puts $fd " [sq [info nameofexecutable]] \\"
135 puts $fd " [sq [file normalize $argv0]]"
138 file attributes $exe -permissions u+x,g+x,o+x
140 error_popup [strcat [mc "Cannot write icon:"] "\n\n$err"]