diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 547f9a70edc..28e0baab29d 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -1515,9 +1515,9 @@ sub do_postaction { } elsif ($pa =~ m/\s*fileassoc\s+(.*)\s*$/) { $ret &&= _do_postaction_fileassoc($how, $do_fileassocs, $tlpobj, $1); next; - } elsif ($pa =~ m/\s*appreg\s+(.*)\s*$/) { + } elsif ($pa =~ m/\s*progid\s+(.*)\s*$/) { next unless $do_fileassocs; - $ret &&= _do_postaction_application($how, $tlpobj, $1); + $ret &&= _do_postaction_progid($how, $tlpobj, $1); } elsif ($pa =~ m/\s*script\s+(.*)\s*$/) { next unless $do_script; $ret &&= _do_postaction_script($how, $tlpobj, $1); @@ -1611,63 +1611,37 @@ sub _do_postaction_filetype { return 1; } -sub _do_postaction_application { +sub _do_postaction_progid { my ($how, $tlpobj, $pa) = @_; return 1 unless win32(); my ($errors, %keyval) = - parse_into_keywords($pa, qw/prog cmd exts/); + parse_into_keywords($pa, qw/extension filetype/); if ($errors) { tlwarn("parsing the postaction line >>$pa<< did not succeed!\n"); return 0; } - # prog - if (!defined($keyval{'prog'})) { - tlwarn("prog of appreg postaction not given\n"); + # name can be an arbitrary string + if (!defined($keyval{'extension'})) { + tlwarn("extension of progid postaction not given\n"); return 0; } - my $prog = $keyval{'prog'}; + my $extension = $keyval{'extension'}; - if (!defined($keyval{'cmd'})) { - tlwarn("cmd of appreg postaction not given\n"); + # cmd can be an arbitrary string + if (!defined($keyval{'filetype'})) { + tlwarn("filetype of progid postaction not given\n"); return 0; } - my $cmd = $keyval{'cmd'}; - - my $exts_arr = []; - my $e; - my $exts = ''; - if (!defined($keyval{'exts'})) { - tlwarn("exts of appreg postaction not given\n"); - } else { - $exts = $keyval{'exts'}; - foreach $e (split /\|/, $exts) { - if ($e =~ /^\./) { - push @$exts_arr, $e; - } else { - tlwarn("Invalid extension $e for $prog ignored\n"); - } - } - } - - my $texdir = `kpsewhich -var-value=SELFAUTOPARENT`; - chomp($texdir); - my $texdir_bsl = conv_to_w32_path($texdir); - $cmd =~ s!^("?)TEXDIR/!$1$texdir/!g; + my $filetype = $keyval{'filetype'}; - &log("postaction $how appreg for " . $tlpobj->name . - ": $prog, $cmd, $exts\n"); + &log("postaction $how progid for " . $tlpobj->name . + ": $extension, $filetype\n"); if ($how eq "install") { - TeXLive::TLWinGoo::register_application($prog, $cmd, $exts_arr); - foreach $e (@$exts_arr) { - TeXLive::TLWinGoo::add_to_openwithlist($e, $prog); - } + TeXLive::TLWinGoo::add_to_progids($extension, $filetype); } elsif ($how eq "remove") { - TeXLive::TLWinGoo::unregister_application($prog); - foreach $e (@$exts_arr) { - TeXLive::TLWinGoo::remove_from_openwithlist($e, $prog); - } + TeXLive::TLWinGoo::remove_from_progids($extension, $filetype); } else { tlwarn("Unknown mode $how\n"); return 0; |