summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm68
1 files changed, 68 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index e4ada1c3b65..4f0362f163a 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -1515,6 +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*$/) {
+ next unless $do_fileassocs;
+ $ret &&= _do_postaction_application($how, $tlpobj, $1);
} elsif ($pa =~ m/\s*script\s+(.*)\s*$/) {
next unless $do_script;
$ret &&= _do_postaction_script($how, $tlpobj, $1);
@@ -1564,6 +1567,7 @@ sub _do_postaction_fileassoc {
}
return 1;
}
+
sub _do_postaction_filetype {
my ($how, $tlpobj, $pa) = @_;
return 1 unless win32();
@@ -1607,6 +1611,70 @@ sub _do_postaction_filetype {
return 1;
}
+sub _do_postaction_application {
+ my ($how, $tlpobj, $pa) = @_;
+ return 1 unless win32();
+ my ($errors, %keyval) =
+ parse_into_keywords($pa, qw/prog cmd exts/);
+
+ 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");
+ return 0;
+ }
+ my $prog = $keyval{'prog'};
+
+ if (!defined($keyval{'cmd'})) {
+ tlwarn("cmd of appreg 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;
+
+ &log("postaction $how appreg for " . $tlpobj->name .
+ ": $prog, $cmd, $exts\n");
+ if ($how eq "install") {
+ TeXLive::TLWinGoo::register_application($prog, $cmd, $exts_arr);
+ foreach $e (@$exts_arr) {
+ TeXLive::TLWinGoo::add_to_openwithlist($e, $prog);
+ }
+ } elsif ($how eq "remove") {
+ TeXLive::TLWinGoo::unregister_application($prog);
+ foreach $e (@$exts_arr) {
+ TeXLive::TLWinGoo::remove_from_openwithlist($e, $prog);
+ }
+ } else {
+ tlwarn("Unknown mode $how\n");
+ return 0;
+ }
+ return 1;
+}
+
sub _do_postaction_script {
my ($how, $tlpobj, $pa) = @_;
my ($errors, %keyval) =