diff options
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/fmtutil.pl | 3 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index 62e7e19b767..3e73d40849e 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -62,6 +62,9 @@ my @deferred_stdout; (our $prg = basename($0)) =~ s/\.pl$//; +# make sure that the main binary path is available at the front +TeXLive::TLUtils::prepend_own_path(); + # sudo sometimes does not reset the home dir of root, check on that # see more comments at the definition of the function itself # this function checks by itself whether it is running on windows or not diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 4426d0dc026..520fb1f88bb 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -98,6 +98,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure TeXLive::TLUtils::tlnet_disabled_packages($root); TeXLive::TLUtils::mktexupd(); TeXLive::TLUtils::setup_sys_user_mode($optsref,$tmfc, $tmfsc, $tmfv, $tmfsv); + TeXLive::TLUtils::prepend_own_path(); =head1 DESCRIPTION @@ -181,6 +182,7 @@ BEGIN { &setup_persistent_downloads &mktexupd &setup_sys_user_mode + &prepend_own_path &nulldev &get_full_line &sort_archs @@ -4062,6 +4064,23 @@ sub setup_sys_user_mode { return ($texmfconfig, $texmfvar); } +=item C<prepend_own_path()> + +Prepends the location of the TeX Live binaries to the PATH environment variable. + +=cut + +sub prepend_own_path { + my $bindir = dirname(Cwd::abs_path(which('kpsewhich'))); + if (win32()) { + $bindir =~ s!\\!/!g; + $ENV{'PATH'} = "$bindir;$ENV{PATH}"; + } else { + $ENV{'PATH'} = "$bindir:$ENV{PATH}"; + } +} + + =back =cut 1; |