aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-05-28 11:28:16 -0400
committerShawn O. Pearce <spearce@spearce.org>2007-05-28 17:50:41 -0400
commitf8371706635b7ea19e8df2739e09b8bd3fbf7768 (patch)
tree40d8d2606bf731c3116a8fd8e0cf3e2ff2ef4ddd
parentcd12901b8f247bfcec161d5de658dae6c8185691 (diff)
downloadgit-f8371706635b7ea19e8df2739e09b8bd3fbf7768.tar.gz
git-f8371706635b7ea19e8df2739e09b8bd3fbf7768.tar.xz
git-gui: Provide fatal error if library is unavailable
If we cannot locate our git-gui library directory, or we find it but the tclIndex file is not present there (or it is present but is not something we are allowed to read) the user cannot use the application. Rather than silently ignoring the errors related to the tclIndex file being unavailable we report them up front and display to the user why we cannot start. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-xgit-gui.sh31
1 files changed, 19 insertions, 12 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 660811633..a5f31dc39 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -50,26 +50,33 @@ if {$oguirel eq {1}} {
} elseif {[string match @@* $oguirel]} {
set oguilib [file join [file dirname [file normalize $argv0]] lib]
}
+
set idx [file join $oguilib tclIndex]
-catch {
- set fd [open $idx r]
- if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
- set idx [list]
- while {[gets $fd n] >= 0} {
- if {$n ne {} && ![string match #* $n]} {
- lappend idx $n
- }
+if {[catch {set fd [open $idx r]} err]} {
+ catch {wm withdraw .}
+ tk_messageBox \
+ -icon error \
+ -type ok \
+ -title "git-gui: fatal error" \
+ -message $err
+ exit 1
+}
+if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
+ set idx [list]
+ while {[gets $fd n] >= 0} {
+ if {$n ne {} && ![string match #* $n]} {
+ lappend idx $n
}
- } else {
- set idx {}
}
- close $fd
+} else {
+ set idx {}
}
+close $fd
+
if {$idx ne {}} {
set loaded [list]
foreach p $idx {
if {[lsearch -exact $loaded $p] >= 0} continue
- puts $p
source [file join $oguilib $p]
lappend loaded $p
}