@@ -12434,6 +12434,17 @@ proc get_path_encoding {path} {
12434
12434
return $tcl_enc
12435
12435
}
12436
12436
12437
+ # Tk9: Expand " ~" and " ~user_name" to canonical path name
12438
+ # Tk8: Just pass original path name to use built-in tilde expander
12439
+ proc tilde_expand {path} {
12440
+ global have_tk90
12441
+ if {$have_tk90 } {
12442
+ return [ file tildeexpand $path ]
12443
+ } else {
12444
+ return $path
12445
+ }
12446
+ }
12447
+
12437
12448
## For msgcat loading, first locate the installation location.
12438
12449
if { [ info exists ::env(GITK_MSGSDIR)] } {
12439
12450
## Msgsdir was manually set in the environment.
@@ -12458,6 +12469,9 @@ if {[catch {package require Tk 8.4-} err]} {
12458
12469
Gitk requires at least Tcl/Tk 8.4." ]
12459
12470
exit 1
12460
12471
}
12472
+ set have_tk85 [ expr {[package vcompare $tk_version " 8.5" ] >= 0}]
12473
+ set have_tk86 [ expr {[package vcompare $tk_version " 8.6" ] >= 0}]
12474
+ set have_tk90 [ expr {[package vcompare $tk_version " 9.0" ] >= 0}]
12461
12475
12462
12476
# on OSX bring the current Wish process window to front
12463
12477
if {[ tk windowingsystem] eq " aqua" } {
@@ -12623,14 +12637,14 @@ catch {
12623
12637
set config_file_tmp [ file join $env(XDG_CONFIG_HOME) git gitk-tmp]
12624
12638
} else {
12625
12639
# default XDG_CONFIG_HOME
12626
- set config_file " ~/.config/git/gitk"
12627
- set config_file_tmp " ~/.config/git/gitk-tmp"
12640
+ set config_file [ tilde_expand " ~/.config/git/gitk" ]
12641
+ set config_file_tmp [ tilde_expand " ~/.config/git/gitk-tmp" ]
12628
12642
}
12629
12643
if {![ file exists $config_file ] } {
12630
12644
# for backward compatibility use the old config file if it exists
12631
- if {[ file exists " ~/.gitk" ] } {
12632
- set config_file " ~/.gitk"
12633
- set config_file_tmp " ~/.gitk-tmp"
12645
+ if {[ file exists [tilde_expand " ~/.gitk" ] ]} {
12646
+ set config_file [ tilde_expand " ~/.gitk" ]
12647
+ set config_file_tmp [ tilde_expand " ~/.gitk-tmp" ]
12634
12648
} elseif {![ file exists [file dirname $config_file ] ]} {
12635
12649
file mkdir [ file dirname $config_file ]
12636
12650
}
@@ -12743,8 +12757,6 @@ set nullid "0000000000000000000000000000000000000000"
12743
12757
set nullid2 " 0000000000000000000000000000000000000001"
12744
12758
set nullfile " /dev/null"
12745
12759
12746
- set have_tk85 [ expr {[package vcompare $tk_version " 8.5" ] >= 0}]
12747
- set have_tk86 [ expr {[package vcompare $tk_version " 8.6" ] >= 0}]
12748
12760
if {![ info exists have_ttk] } {
12749
12761
set have_ttk [ llength [info commands ::ttk::style] ]
12750
12762
}
0 commit comments