git-gui: Collapse $env(HOME) to ~/ in recent repositories on Windows
Apparently native Tcl/Tk on Windows is using \ as the return value from [file separator] but [file normalize] on that same system is using / rather than \ to represent a directory separator. I really think that is nuts, but its what is happening. So we can actually just hardcode our separator to / as all systems we support (Windows, Mac OS X, UNIX) use /. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Oct 12, 2007 at 16:33 UTC
82dd4e0465282e39962ba8fdb01c42aa665b1999
1 file changed
+6
-2
lib/choose_repository.tcl
+6
-2
@@ -140,12 +140,16 @@ constructor pick {} {
140
$w_recentlist tag conf link \
141
-foreground blue \
142
-underline 1
143
- set home "[file normalize $::env(HOME)][file separator]"
143
+ set home $::env(HOME)
144
+ if {[is_Cygwin]} {
145
+ set home [exec cygpath --windows --absolute $home]
146
+ }
147
+ set home "[file normalize $home]/"
148
set hlen [string length $home]
149
foreach p $sorted_recent {
150
set path $p
151
if {[string equal -length $hlen $home $p]} {
148
- set p "~[file separator][string range $p $hlen end]"
152
+ set p "~/[string range $p $hlen end]"
153
}
154
regsub -all "\n" $p "\\n" p
155
$w_recentlist insert end $p link