git-gui: Locate the library directory early during startup
To support a localized version of git-gui we need to locate the library directory early so we can initialize Tcl's msgcat package to load translated messages from. This needs to occur before we declare our git-version proc so that errors related to locating git or assessing its version can be reported to the end-user in their preferred language. However we have to keep the library loading until after git-version has been declared, otherwise we will fail to start git-gui if we are using a fake tclIndex that was generated by our Makefile. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
c80d25dbce
commit
fc703c209d
25
git-gui.sh
25
git-gui.sh
@ -42,6 +42,20 @@ if {[catch {package require Tcl 8.4} err]
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
##
|
||||||
|
## locate our library
|
||||||
|
|
||||||
|
set oguilib {@@GITGUI_LIBDIR@@}
|
||||||
|
set oguirel {@@GITGUI_RELATIVE@@}
|
||||||
|
if {$oguirel eq {1}} {
|
||||||
|
set oguilib [file dirname [file dirname [file normalize $argv0]]]
|
||||||
|
set oguilib [file join $oguilib share git-gui lib]
|
||||||
|
} elseif {[string match @@* $oguirel]} {
|
||||||
|
set oguilib [file join [file dirname [file normalize $argv0]] lib]
|
||||||
|
}
|
||||||
|
unset oguirel
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
##
|
##
|
||||||
## enable verbose loading?
|
## enable verbose loading?
|
||||||
@ -595,15 +609,6 @@ You are using [git-version]:
|
|||||||
##
|
##
|
||||||
## configure our library
|
## configure our library
|
||||||
|
|
||||||
set oguilib {@@GITGUI_LIBDIR@@}
|
|
||||||
set oguirel {@@GITGUI_RELATIVE@@}
|
|
||||||
if {$oguirel eq {1}} {
|
|
||||||
set oguilib [file dirname [file dirname [file normalize $argv0]]]
|
|
||||||
set oguilib [file join $oguilib share git-gui lib]
|
|
||||||
} elseif {[string match @@* $oguirel]} {
|
|
||||||
set oguilib [file join [file dirname [file normalize $argv0]] lib]
|
|
||||||
}
|
|
||||||
|
|
||||||
set idx [file join $oguilib tclIndex]
|
set idx [file join $oguilib tclIndex]
|
||||||
if {[catch {set fd [open $idx r]} err]} {
|
if {[catch {set fd [open $idx r]} err]} {
|
||||||
catch {wm withdraw .}
|
catch {wm withdraw .}
|
||||||
@ -637,7 +642,7 @@ if {$idx ne {}} {
|
|||||||
} else {
|
} else {
|
||||||
set auto_path [concat [list $oguilib] $auto_path]
|
set auto_path [concat [list $oguilib] $auto_path]
|
||||||
}
|
}
|
||||||
unset -nocomplain oguirel idx fd
|
unset -nocomplain idx fd
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
##
|
##
|
||||||
|
Loading…
Reference in New Issue
Block a user