1 # git-gui desktop icon creators
2 # Copyright (C) 2006, 2007 Shawn Pearce
4 proc do_windows_shortcut {} {
7 set fn [tk_getSaveFile \
9 -title "[appname] ([reponame]): Create Desktop Icon" \
10 -initialfile "Git [reponame].bat"]
14 puts $fd "@ECHO Entering [reponame]"
15 puts $fd "@ECHO Starting git-gui... please wait..."
16 puts $fd "@SET PATH=[file normalize [gitexec]];%PATH%"
17 puts $fd "@SET GIT_DIR=[file normalize [gitdir]]"
18 puts -nonewline $fd "@\"[info nameofexecutable]\""
19 puts $fd " \"[file normalize $argv0]\""
22 error_popup "Cannot write script:\n\n$err"
27 proc do_cygwin_shortcut {} {
31 set desktop [exec cygpath \
39 set fn [tk_getSaveFile \
41 -title "[appname] ([reponame]): Create Desktop Icon" \
42 -initialdir $desktop \
43 -initialfile "Git [reponame].bat"]
47 set sh [exec cygpath \
51 set me [exec cygpath \
55 set gd [exec cygpath \
59 set gw [exec cygpath \
62 [file dirname [gitdir]]]
63 regsub -all ' $me "'\\''" me
64 regsub -all ' $gd "'\\''" gd
65 puts $fd "@ECHO Entering $gw"
66 puts $fd "@ECHO Starting git-gui... please wait..."
67 puts -nonewline $fd "@\"$sh\" --login -c \""
68 puts -nonewline $fd "GIT_DIR='$gd'"
69 puts -nonewline $fd " '$me'"
73 error_popup "Cannot write script:\n\n$err"
78 proc do_macosx_app {} {
81 set fn [tk_getSaveFile \
83 -title "[appname] ([reponame]): Create Desktop Icon" \
84 -initialdir [file join $env(HOME) Desktop] \
85 -initialfile "Git [reponame].app"]
88 set Contents [file join $fn Contents]
89 set MacOS [file join $Contents MacOS]
90 set exe [file join $MacOS git-gui]
94 set fd [open [file join $Contents Info.plist] w]
95 puts $fd {<?xml version="1.0" encoding="UTF-8"?>
96 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
99 <key>CFBundleDevelopmentRegion</key>
100 <string>English</string>
101 <key>CFBundleExecutable</key>
102 <string>git-gui</string>
103 <key>CFBundleIdentifier</key>
104 <string>org.spearce.git-gui</string>
105 <key>CFBundleInfoDictionaryVersion</key>
107 <key>CFBundlePackageType</key>
108 <string>APPL</string>
109 <key>CFBundleSignature</key>
110 <string>????</string>
111 <key>CFBundleVersion</key>
113 <key>NSPrincipalClass</key>
114 <string>NSApplication</string>
120 set gd [file normalize [gitdir]]
121 set ep [file normalize [gitexec]]
122 regsub -all ' $gd "'\\''" gd
123 regsub -all ' $ep "'\\''" ep
125 foreach name [array names env] {
126 if {[string match GIT_* $name]} {
127 regsub -all ' $env($name) "'\\''" v
128 puts $fd "export $name='$v'"
131 puts $fd "export PATH='$ep':\$PATH"
132 puts $fd "export GIT_DIR='$gd'"
133 puts $fd "exec [file normalize $argv0]"
136 file attributes $exe -permissions u+x,g+x,o+x
138 error_popup "Cannot write icon:\n\n$err"