2
# Copyright (C) 2006, 2007 Shawn Pearce
3
4
proc do_windows_shortcut {} {
5
- global argv0
6
-
5
set fn [tk_getSaveFile \
6
-parent . \
7
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
10
- -initialfile "Git [reponame].bat"]
8
+ -initialfile "Git [reponame].lnk"]
9
if {$fn != {}} {
12
- if {[file extension $fn] ne {.bat}} {
13
- set fn ${fn}.bat
10
+ if {[file extension $fn] ne {.lnk}} {
11
+ set fn ${fn}.lnk
12
}
13
if {[catch {
16
- set ge [file normalize [file dirname $::_git]]
17
- set fd [open $fn w]
18
- puts $fd "@ECHO Entering [reponame]"
19
- puts $fd "@ECHO Starting git-gui... please wait..."
20
- puts $fd "@SET PATH=$ge;%PATH%"
21
- puts $fd "@SET GIT_DIR=[file normalize [gitdir]]"
22
- puts -nonewline $fd "@\"[info nameofexecutable]\""
23
- puts $fd " \"[file normalize $argv0]\""
24
- close $fd
14
+ win32_create_lnk $fn [list \
15
+ [info nameofexecutable] \
16
+ [file normalize $::argv0] \
17
+ ] \
18
+ [file dirname [file normalize [gitdir]]]
19
} err]} {
26
- error_popup [strcat [mc "Cannot write script:"] "\n\n$err"]
20
+ error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
21
}
22
}
23
}
38
-parent . \
39
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
40
-initialdir $desktop \
47
- -initialfile "Git [reponame].bat"]
41
+ -initialfile "Git [reponame].lnk"]
42
if {$fn != {}} {
49
- if {[file extension $fn] ne {.bat}} {
50
- set fn ${fn}.bat
43
+ if {[file extension $fn] ne {.lnk}} {
44
+ set fn ${fn}.lnk
45
}
46
if {[catch {
53
- set fd [open $fn w]
47
set sh [exec cygpath \
48
--windows \
49
--absolute \
52
--unix \
53
--absolute \
54
$argv0]
62
- set gd [exec cygpath \
63
- --unix \
64
- --absolute \
65
- [gitdir]]
66
- puts $fd "@ECHO Entering [reponame]"
67
- puts $fd "@ECHO Starting git-gui... please wait..."
68
- puts -nonewline $fd "@\"$sh\" --login -c \""
69
- puts -nonewline $fd "GIT_DIR=[sq $gd]"
70
- puts -nonewline $fd " [sq $me]"
71
- puts $fd " &\""
72
- close $fd
55
+ win32_create_lnk $fn [list \
56
+ $sh -c \
57
+ "CHERE_INVOKING=1 source /etc/profile;[sq $me]" \
58
+ ] \
59
+ [file dirname [file normalize [gitdir]]]
60
} err]} {
74
- error_popup [strcat [mc "Cannot write script:"] "\n\n$err"]
61
+ error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
62
}
63
}
64
}