summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlpostcode/texworks.pl
blob: af0937a94e903db58de20eee1b8b91b29466b3f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# $Id$
# post action for texworks
# Copyright 2009 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.

my $texdir;
my $mode;

BEGIN {
  $^W = 1;
  $mode = $ARGV[0];
  $texdir = $ARGV[1];
  # make Perl find our packages first:
  unshift (@INC, "$texdir/tlpkg");
}

use TeXLive::TLUtils qw(win32 mkdirhier conv_to_w32_path log info tlwarn);

if ($mode eq "install") {
  for my $f (<$texdir/bin/*>) {
    next if ! -d $f;
    open (TWI, ">$f/texworks-setup.ini") 
      || tlwarn "Cannot open $f/texworks-setup.ini";
    print TWI "defaultbinpaths = $f\n";
    close TWI;
  }
} elsif ($mode eq "remove") {
  unlink <$texdir/bin/texworks-setup.ini>;
} else {
  tlwarn ("texworks post action: unknown mode $mode\n");
}
 
exit 0;

### Local Variables:
### perl-indent-level: 2
### tab-width: 2
### indent-tabs-mode: nil
### End:
# vim:set tabstop=2 expandtab: #