From 8e63c701619069796c0ff9f29d462db905585e41 Mon Sep 17 00:00:00 2001 From: Piotr Strzelczyk Date: Mon, 9 Nov 2009 00:42:20 +0000 Subject: don't slash the path git-svn-id: svn://tug.org/texlive/trunk@15949 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLWinGoo.pm | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'Master') diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 9efc7c39356..52a0233a39a 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -356,7 +356,6 @@ forward slashes. sub get_system_path { my $value = get_system_env() -> {'/Path'}; - $value =~ s/\\/\//g; # Remove terminating zero bytes; there may be several, at least # under w2k, and the FixSzNulls option only removes one. $value =~ s/[\s\x00]+$//; @@ -376,7 +375,6 @@ expandable. sub get_user_path { my $value = get_user_env() -> {'/Path'}; return "" if not $value; - $value =~ s/\\/\//g; $value =~ s/[\s\x00]+$//; return $value; } @@ -399,6 +397,7 @@ sub win_which_dir { my $path = expand_string(get_system_path()); my $user_path = expand_string(get_user_path()); $path = $path . ';' . $user_path if $user_path; + $path =~ s/\\/\//g; foreach $d (split (';',$path)) { $d =~ s/\/$//; return $d if -e $d.'/'.$prog; @@ -498,9 +497,9 @@ to system or user PATH variable in the registry (depending on $mode). sub adjust_reg_path_for_texlive { my ($action, $tlbindir, $mode) = @_; die("Unknown path action: $action\n") - if ($action ne 'add') and ($action ne 'remove'); + if ($action ne 'add') && ($action ne 'remove'); die("Unknown path mode: $mode\n") - if ($mode ne 'system') and ($mode ne 'user'); + if ($mode ne 'system') && ($mode ne 'user'); debug("Warning: [pdf]tex program not found in $tlbindir\n") if (!is_a_texdir($tlbindir)); my $path = ($mode eq 'system') ? get_system_path() : get_user_path(); @@ -508,18 +507,23 @@ sub adjust_reg_path_for_texlive { my $tlbindir_short = uc(short_name($tlbindir)); my ($d, $d_short, @newpath); my $tex_dir_conflict = 0; + my @texdirs; foreach $d (split (';', $path)) { $d_short = uc(short_name(expand_string($d))); $d_short =~ s!/!\\!g; ddebug("adjust_reg: compar $d_short with $tlbindir_short\n"); if ($d_short ne $tlbindir_short) { push(@newpath, $d); - $tex_dir_conflict += is_a_texdir($d); + if (is_a_texdir($d)) { + $tex_dir_conflict++; + push(@texdirs, $d); + } } } if ($action eq 'add') { if ($tex_dir_conflict) { - debug("Warning: conflicting [pdf]tex found on the $mode path in $d; appending texlive bin dir to the front."); + log("Warning: conflicting [pdf]tex program found on the $mode path ", + "in @texdirs; appending $tlbindir to the front of the path."); unshift(@newpath, $tlbindir); } else { push(@newpath, $tlbindir); @@ -532,8 +536,11 @@ sub adjust_reg_path_for_texlive { debug("TLWinGoo: adjust_reg_path_for_texlive: calling unsetenv_reg in $mode\n"); unsetenv_reg("Path", $mode); } - if (($action eq 'add') and ($mode eq 'user') and tex_dirs_on_path(get_system_path())) { - tlwarn("Warning: conflicting [pdf]tex found on the system path in $d; not fixable in user mode."); + if ( ($action eq 'add') && ($mode eq 'user') ) { + @texdirs = tex_dirs_on_path( get_system_path() ); + return 0 unless (@texdirs); + tlwarn("Warning: conflicting [pdf]tex program found on the system path ", + "in @texdirs; not fixable in user mode."); return 1; } return 0; -- cgit v1.2.3