diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 4b8766abedd..b31858dd512 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -61,6 +61,7 @@ C<TeXLive::TLUtils> -- Utilities used in the TeX Live Infrastructure Modules TeXLive::TLUtils::push_uniq(\@list, @items); TeXLive::TLUtils::member($item, @list); TeXLive::TLUtils::debug($string); + TeXLive::TLUtils::kpsewhich; =head1 DESCRIPTION @@ -100,6 +101,7 @@ BEGIN { &push_uniq &member &debug + &kpsewhich "ewords ); } @@ -223,7 +225,13 @@ Return C<1> if platform is Windows and C<0> otherwise. =cut sub win32 { - return (&platform eq "win32")? 1:0; + if ($^O=~/^MSWin(32|64)$/i) { + return 1; + } else { + return 0; + } + # the following needs config.guess, which is quite bad ... + # return (&platform eq "win32")? 1:0; } =pod @@ -1069,6 +1077,27 @@ sub debug { print STDERR "tldbg: @_\n" if $::opt_debug; } +=pod + +=item C<kpsewhich($varname)> + +This function expands the variable name using kpsewhich. The variable +name should not have a leading $. The kpsewhich binary has to be in +the path. + +=cut + +sub kpsewhich { + my $var = shift; + my $ret; + if (win32()) { + $ret = `kpsewhich -expand-var \$$var`; + } else { + $ret = `kpsewhich -expand-var '\$$var'`; + } + chomp ($ret); + return($ret); +} ############################################# |