summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLWinGoo.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-10-09 03:50:18 +0000
committerNorbert Preining <preining@logic.at>2009-10-09 03:50:18 +0000
commit01f6d14e25a0386ffb76ddf7367a9e3b79f6b772 (patch)
tree858fbcee9aed7395b81bb53d5bd3a8f8d7b8f56a /Master/tlpkg/TeXLive/TLWinGoo.pm
parent17cfed16161d26cabb8e604c7c0dc6c7fed9c73b (diff)
fix TLWinGoo to remove a key if it is already present and matches our
own key git-svn-id: svn://tug.org/texlive/trunk@15716 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLWinGoo.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm24
1 files changed, 19 insertions, 5 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index a0b5122548f..014564331c0 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -585,17 +585,25 @@ sub register_extension {
my $file_type = shift;
debug("Linking $extension to $file_type\n");
- my ($classes_key, $k);
+ my ($classes_key_path, $classes_key, $k);
$extension = lc($extension);
if ($is_admin) {
- $classes_key = $Registry -> Open("LMachine/Software/Classes/",
- {Access => KEY_ALL_ACCESS()}) or die "Cannot open classpath";
+ $classes_key_path = "LMachine/Software/Classes/";
} else {
- $classes_key = $Registry -> Open("CUser/Software/Classes/",
- {Access => KEY_ALL_ACCESS()});
+ $classes_key_path = "CUser/Software/Classes/";
}
+ $classes_key = $Registry -> Open($classes_key_path,
+ {Access => KEY_ALL_ACCESS()});
+
+ if (!defined($classes_key)) {
+ tlwarn("Cannot get key to $classes_key\n" .
+ "Cannot continue setting up associations.\n");
+ # should we die here in the admin case?
+ # so it was before, but that is probably not the best idea
+ return;
+ }
my $do_create_key = 0;
@@ -604,6 +612,8 @@ sub register_extension {
if (defined($classes_key->{$extension}->{'/'})) {
if ($classes_key->{$extension}->{'/'} eq $file_type) {
debug("register_extension: already same key $extension $file_type present, recreate it\n");
+ # delete it so that it is recreated ...
+ delete $classes_key -> {$extension};
$do_create_key = 1;
} else {
debug("register_extension: old foreign key" . $classes_key->{$extension}->{'/'} . " found, not changing\n");
@@ -621,6 +631,10 @@ sub register_extension {
if ($do_create_key) {
$k = $classes_key->CreateKey($extension);
+ if (!defined($k)) {
+ tlwarn("Cannot create key for $extension in $classes_key_path.\n");
+ return;
+ }
$k -> ArrayValues(0);
$k -> {"/"} = $file_type;
if (admin()) {