2 # Tcl ignores the next line -*- tcl -*- \
5 # Copyright (C) 2007 Johannes E. Schindelin. All rights reserved.
6 # This program is free software; it may be used, copied, modified
7 # and distributed under the terms of the GNU General Public Licence,
8 # either version 2, or (at your option) any later version.
11 global currentDirectory answer env
14 text .listbox.list
-yscrollcommand ".listbox.scroll set"
15 scrollbar .listbox.scroll
-command ".listbox.list yview"
16 pack .listbox.scroll
-side right
-fill y
17 pack .listbox.list
-expand yes -fill both
20 set list
[open
"$currentDirectory/fileList-builtins.txt" r
]
21 while {[gets
$list line
] >= 0} {
22 .listbox.list insert end
"copying builtin: $line\n"
23 .listbox.list yview moveto
1
25 file copy
-force $currentDirectory/bin
/git.exe \
26 $currentDirectory/$line
34 set destinations
[list
]
35 set answer
[tk_dialog .question
"Desktop Icon" \
36 "Would you like to add a Git icon to the Desktop?" \
39 lappend destinations
$env(USERPROFILE
)/Desktop
42 set answer
[tk_dialog .question
"Quick Launch" \
43 "Would you like to add a Quick Launch icon?" \
46 set appdata
[regsub
-all "\\\\" $env(APPDATA
) "/"]
47 lappend destinations \
48 "$appdata/Microsoft/Internet Explorer/Quick Launch"
51 wm title .question
"Start Menu item"
53 set maxsize
[wm maxsize .question
]
54 set question_width
320
55 set question_height
80
56 set question_x
[expr ([lindex
$maxsize 0] - $question_width) / 2]
57 set question_y
[expr ([lindex
$maxsize 1] - $question_height) / 2]
58 wm geometry .question
[format
"%dx%d+%d+%d" \
59 $question_width $question_height $question_x $question_y]
60 label .question.label
-text \
61 "Would you like to add a start menu item?"
63 label .question.name.name
-text "Name:"
65 set startMenuName
"Git"
66 entry .question.name.entry
-textvariable startMenuName
67 pack .question.name.name .question.name.entry \
68 -fill x
-expand true
-side left
69 frame .question.buttons
71 button .question.buttons.
yes -text Yes
-default active \
76 bind .question
<KeyPress
> {
77 if {[string equal
%K
"Return"]} {
81 if {[string equal
%K
"Escape"]} {
86 button .question.buttons.no
-text No
-command {
90 pack .question.buttons.
yes .question.buttons.no \
91 -fill x
-expand true
-side left
92 pack .question.label .question.name .question.buttons \
94 focus
-force .question
95 tkwait window .question
97 package require registry
1.0
98 set key
"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows"
99 set key
"$key\\CurrentVersion\\Explorer\\Shell Folders"
100 set programs
[registry get
$key "Common Programs"]
101 file mkdir
$programs/$startMenuName
102 lappend destinations
$programs/$startMenuName
106 # TODO: incorporate git-cheetah
108 foreach location
$destinations {
109 exec bin
/create-shortcut.exe
--work-dir $currentDirectory \
110 --icon-file $currentDirectory/etc
/git.ico \
111 --arguments "--login -i" \
112 $currentDirectory/bin
/sh.exe
$location/Git\ Shell.lnk
115 file delete
$currentDirectory/fileList.txt
116 file delete
$currentDirectory/fileList-builtins.txt
118 tk_dialog .info
"WinGit installed" \
119 "WinGit was successfully installed" info
0 OK
125 set currentDirectory
[lindex
$argv 0]