@matheusbsbs / matheus-bagliano / commits / 47282d4646
Fork 0

git-gui: Ensure windows shortcuts always have .bat extension

Apparently under some setups on Windows Tk is hiding our file extension recommendation of ".bat" from the user and that is allowing the user to create a shortcut file which has no file extension. Double clicking on such a file in Windows Explorer brings up the associate file dialog, as Windows does not know what application to launch. We now append the file extension ".bat" to the filename of the shortcut file if it has no extension or if it has one but it is not ".bat". Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 5, 2007 at 18:39 UTC 47282d4646372aa859908c3b9471b96c385abe5f
1 file changed +6
lib/shortcut.tcl
+6
@@ -9,6 +9,9 @@ proc do_windows_shortcut {} {
9 -title "[appname] ([reponame]): Create Desktop Icon" \
10 -initialfile "Git [reponame].bat"]
11 if {$fn != {}} {
12 + if {[file extension $fn] ne {.bat}} {
13 + set fn ${fn}.bat
14 + }
15 if {[catch {
16 set fd [open $fn w]
17 puts $fd "@ECHO Entering [reponame]"
@@ -42,6 +45,9 @@ proc do_cygwin_shortcut {} {
45 -initialdir $desktop \
46 -initialfile "Git [reponame].bat"]
47 if {$fn != {}} {
48 + if {[file extension $fn] ne {.bat}} {
49 + set fn ${fn}.bat
50 + }
51 if {[catch {
52 set fd [open $fn w]
53 set sh [exec cygpath \