From 4594335a6c77e53d07dd5f0333080655bfb003c2 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Sun, 13 Apr 2008 10:13:35 +0000 Subject: Win32 portable option: PATHEXT set by batchfile, only for current process. git-svn-id: svn://tug.org/texlive/trunk@7400 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl.pl | 12 +++--- Master/tl-portable.bat | 1 + Master/tlpkg/TeXLive/TLWinGoo.pm | 92 +++++++++++++++++++++------------------- 3 files changed, 55 insertions(+), 50 deletions(-) diff --git a/Master/install-tl.pl b/Master/install-tl.pl index 56711e63172..aa273d1dd8c 100755 --- a/Master/install-tl.pl +++ b/Master/install-tl.pl @@ -143,7 +143,7 @@ my $opt_quiet = 0; my $opt_qquiet = 0; my $opt_nonadmin = 0; my $opt_arch = 0; -my $opt_portable = 0; +our $opt_portable = 0; my $opt_help = 0; my $opt_version = 0; my $opt_gui = 0; @@ -1206,11 +1206,11 @@ to install TeX Live from various media including the network. =head1 PORTABLE USE The TeXLive root directory contains a shell script tl-portable.sh -and a DOS batch file which start up a new shell and command prompt -in which TeXLive can be run with minimal impact on the host -system. These files start up install-tl.pl with the -portable option -for some minimal preparation. Don't use this option directly; it -makes very specific assumptions about its environment. +and a DOS batch file tl-portable.bat which start up a new shell and +command prompt in which TeXLive can be run with minimal impact on +the host system. These files start up install-tl.pl with the +-portable option for some minimal preparation. Don't use this option +directly; it makes very specific assumptions about its environment. =head1 AUTHORS AND COPYRIGHT diff --git a/Master/tl-portable.bat b/Master/tl-portable.bat index 86459c050c9..ccdc2e53d48 100755 --- a/Master/tl-portable.bat +++ b/Master/tl-portable.bat @@ -38,6 +38,7 @@ set TEXMFHOME=%tlwrite%texmf-home set TEXMFVAR=%tlwrite%texmf-var set TEXMFCONFIG=%tlwrite%texmf-config set TEXBINDIR=%TEXDIR%bin\win32 +set PATHEXT=%PATHEXT%;.TEXLUA set platform=win32 rem use provided Perl diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 8e4c79a5303..29c73546210 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -638,31 +638,33 @@ sub register_script_type { my ($pathext, $found, $e, $classes_key, $k); # pathext - if ($is_admin) { - # system pathext - $pathext = $system_env -> {'/PATHEXT'}; - $found = 0; - foreach $e (split(/;/,$pathext)) { - $found = 1 if (uc($e) eq $extension); - } - setenv_reg("PATHEXT", $pathext.";".$extension, "system") unless $found; - # user pathext - $pathext = $user_env -> {'/PATHEXT'}; - if ($pathext) { + if (!$::opt_portable) { + if ($is_admin) { + # system pathext + $pathext = $system_env -> {'/PATHEXT'}; + $found = 0; + foreach $e (split(/;/,$pathext)) { + $found = 1 if (uc($e) eq $extension); + } + setenv_reg("PATHEXT", $pathext.";".$extension, "system") unless $found; + # user pathext + $pathext = $user_env -> {'/PATHEXT'}; + if ($pathext) { + $found = 0; + foreach $e (split(/;/,$pathext)) { + $found = 1 if (uc($e) eq $extension); + } + setenv_reg("PATHEXT", $pathext.";".$extension, "user") unless $found; + } + } else { # non-admin + $pathext = $user_env -> {'/PATHEXT'}; + $pathext = $system_env -> {'/PATHEXT'} if not $pathext; $found = 0; foreach $e (split(/;/,$pathext)) { $found = 1 if (uc($e) eq $extension); } setenv_reg("PATHEXT", $pathext.";".$extension, "user") unless $found; } - } else { # non-admin - $pathext = $user_env -> {'/PATHEXT'}; - $pathext = $system_env -> {'/PATHEXT'} if not $pathext; - $found = 0; - foreach $e (split(/;/,$pathext)) { - $found = 1 if (uc($e) eq $extension); - } - setenv_reg("PATHEXT", $pathext.";".$extension, "user") unless $found; } # file type @@ -714,18 +716,33 @@ sub unregister_script_type { my ($pathext, @newpe, $newpex, $e); # pathext - tllog ($::LOG_DDEBUG, "Reverting PATHEXT\n"); - if ($is_admin) { - $pathext = $system_env -> {'/PATHEXT'}; - @newpe = (); - foreach $e (split(/;/,$pathext)) { - push @newpe, $e unless (uc($e) eq $extension); - } - $newpex = join(";",@newpe); - setenv_reg("PATHEXT", $newpex, "system"); - - $pathext = $user_env -> {'/PATHEXT'}; - if ($pathext) { + if (!$::opt_portable) { + tllog ($::LOG_DDEBUG, "Reverting PATHEXT\n"); + if ($is_admin) { + $pathext = $system_env -> {'/PATHEXT'}; + @newpe = (); + foreach $e (split(/;/,$pathext)) { + push @newpe, $e unless (uc($e) eq $extension); + } + $newpex = join(";",@newpe); + setenv_reg("PATHEXT", $newpex, "system"); + + $pathext = $user_env -> {'/PATHEXT'}; + if ($pathext) { + @newpe = (); + foreach $e (split(/;/,$pathext)) { + push @newpe, $e unless (uc($e) eq $extension); + } + $newpex = join(";",@newpe); + if ($newpex eq ($system_env -> {"/PATHEXT"})) { + unsetenv_reg("PATHEXT", "user"); + } else { + setenv_reg("PATHEXT", $newpex, "user"); + } + } + } else { + $pathext = $user_env -> {'/PATHEXT'}; + $pathext = $system_env -> {'/PATHEXT'} unless $pathext; @newpe = (); foreach $e (split(/;/,$pathext)) { push @newpe, $e unless (uc($e) eq $extension); @@ -737,19 +754,6 @@ sub unregister_script_type { setenv_reg("PATHEXT", $newpex, "user"); } } - } else { - $pathext = $user_env -> {'/PATHEXT'}; - $pathext = $system_env -> {'/PATHEXT'} unless $pathext; - @newpe = (); - foreach $e (split(/;/,$pathext)) { - push @newpe, $e unless (uc($e) eq $extension); - } - $newpex = join(";",@newpe); - if ($newpex eq ($system_env -> {"/PATHEXT"})) { - unsetenv_reg("PATHEXT", "user"); - } else { - setenv_reg("PATHEXT", $newpex, "user"); - } } # file type -- cgit v1.2.3