From a29d1c3b81e693ba943ca1ccedfca84d69edd770 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Thu, 19 Jun 2008 19:52:40 +0000 Subject: TLWingoo: removed wg_error; never remove system directories from path whatever TeX programs they may contain git-svn-id: svn://tug.org/texlive/trunk@8879 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLWinGoo.pm | 56 +++++++++------------------------------- 1 file changed, 12 insertions(+), 44 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLWinGoo.pm') diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 24e5ead4b96..593241f0d35 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -22,10 +22,6 @@ C -- Additional utilities for Windows use TeXLive::TLWinGoo; -=head2 ERROR HANDLING - - TeXLive::TLWinGoo::wg_error; - =head2 DIAGNOSTICS TeXLive::TLWinGoo::win_version; @@ -82,7 +78,6 @@ BEGIN { use vars qw( @ISA @EXPORT $Registry); @ISA = qw( Exporter ); @EXPORT = qw( - &wg_error &win_version &is_vista &admin @@ -141,31 +136,6 @@ my $is_win = $^O=~/^MSWin(32|64)$/i; =back -=head2 ERROR HANDLING - -=over 6 - -=item C - -Returns WinGoo error status, in the shape of an array (number, -message) and clears the error status. No error <=> error number 0 - -=cut - -my $wg_error = 0; -my $wg_error_message = ""; - -sub wg_error { - my @retval = ($wg_error, $wg_error_message); - $wg_error = 0; - $wg_error_message = ""; - return @retval; -} - -=pod - -=back - =head2 DIAGNOSTICS =over 6 @@ -332,11 +302,15 @@ sub global_tmpdir { return $global_tmp; } sub is_a_texdir { my $d = shift; - #my $xd = expand_string($d); $d =~ s/\\/\//g; - $d =~ s/\/$//; - my $d1 = $d . '/pdftex.exe'; - my $d2 = $d . '/tex.exe'; + $d = $d . '/' unless $d =~ m!/$!; + # don't consider anything under %systemroot% a texdir + my $sr = uc(expand_string($ENV{'SystemRoot'})); + $sr =~ s/\\/\//g; + $sr = $sr . '/' unless $sr =~ m!/$!; + return 0 if index($d, $sr)==0; + my $d1 = $d . 'pdftex.exe'; + my $d2 = $d . 'tex.exe'; return ((-e $d1) or (-e $d2)); } @@ -462,14 +436,13 @@ sub unsetenv_reg { Remove wrong TeX directories from system path (if possible) and user path. A directory is a TeX directory if it contains tex.exe or -pdftex.exe. Then if necessary add desired TeX directory; to system path if -admin, otherwise to user path. wg_error gets set if there is a -connflicting tex directory which cannot be removed from the path. +pdftex.exe and if it is not under %systemroot%. Then if necessary +add desired TeX directory; to system path if admin, otherwise to +user path. =cut sub add_texbindir_to_path { - $wg_error = 0; # clear error status my $texbindir = shift; my $system_env = get_system_env(); @@ -510,10 +483,7 @@ sub add_texbindir_to_path { if (uc($d_exp) eq uc($texbindir)) { $found = 1; } elsif (is_a_texdir($d_exp)) { - $wg_error = 1; - $wg_error_message = - "Warning: possibly conflicting [pdf]TeX program found at $d_exp\n"; - debug($wg_error_message); + debug("Warning: possibly conflicting [pdf]TeX program found at $d_exp\n"); } } } @@ -555,7 +525,6 @@ system path. =cut sub remove_texbindirs_from_path { - $wg_error = 0; # clear error status my $system_env = get_system_env(); my $user_env = get_user_env(); @@ -773,7 +742,6 @@ sub broadcast_env() { use constant WM_SETTINGCHANGE => 0x001A; my $result = ""; my $SendMessage; - $wg_error = 0; debug("Broadcasting \"Enviroment settings changed\" message...\n"); $SendMessage = new Win32::API('user32', 'SendMessage', 'LLPP', 'L'); $result = $SendMessage->Call(HWND_BROADCAST, WM_SETTINGCHANGE, -- cgit v1.2.3