diff options
author | Norbert Preining <preining@logic.at> | 2008-01-08 07:20:14 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-01-08 07:20:14 +0000 |
commit | a52a937d8c34af66d30aa45c12e190b52251e34a (patch) | |
tree | e848af33704cbb3be2acfe60b714e98e4062c210 | |
parent | 702483003d18501b936550e63835d98841ac78af (diff) |
add kpsewhich function,
make win32 simpler
git-svn-id: svn://tug.org/texlive/trunk@6131 c570f23f-e606-0410-a88d-b1316a301751
-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); +} ############################################# |