diff options
author | Norbert Preining <preining@logic.at> | 2009-07-06 13:12:07 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-07-06 13:12:07 +0000 |
commit | 21c401925b2e3b1b3073b0eaf846281b6fa5d62c (patch) | |
tree | b9e351564b082eeb388208fbc482bdb525a46a86 /Master/tlpkg/TeXLive/TLUtils.pm | |
parent | 06ef2f3fec53b17649761eb9a6fb6910cad99830 (diff) |
- put the add/remove path to reg for w32 into separate function in TLUtils,
- use these funcions in install-tl and uninstall-win32.pl
git-svn-id: svn://tug.org/texlive/trunk@14147 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index d41f7819cff..2d4cbe0cb90 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -64,6 +64,8 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::announce_execute_actions($how, @executes); TeXLive::TLUtils::add_symlinks($root, $arch, $sys_bin, $sys_man, $sys_info); TeXLive::TLUtils::remove_symlinks($root, $arch, $sys_bin, $sys_man, $sys_info); + TeXLive::TLUtils::w32_add_to_path($bindir, $multiuser); + TeXLive::TLUtils::w32_remove_from_path($bindir, $multiuser); =head2 Miscellaneous @@ -128,6 +130,8 @@ BEGIN { &announce_execute_actions &add_symlinks &remove_symlinks + &w32_add_to_path + &w32_remove_from_path &tlcmp ); @EXPORT = qw(setup_programs download_file process_logging_options @@ -1809,7 +1813,65 @@ sub remove_symlinks { return (add_remove_symlinks("remove", @_)); } +=pod + +=item C<w32_add_to_path($bindir, $multiuser)> +=item C<w32_remove_from_path($bindir, $multiuser)> + +These two functions try to add/remove the binary directory $bindir +on Windows to the registry PATH variable. + +If running as admin user and $multiuser is set, the system path will +be adjusted, otherwise the user path. + +After calling these functions TeXLive::TLWinGoo::broadcast_env() should +be called to make the changes immediately visible. +=cut + +sub w32_add_to_path { + my ($bindir, $multiuser) = @_; + return if (!win32()); + + TeXLive::TLWinGoo::update_assocs(); + my $path = TeXLive::TLWinGoo::get_system_env() -> {'/Path'}; + $path =~ s/[\s\x00]+$//; + log("Old system path: $path\n"); + $path = TeXLive::TLWinGoo::get_user_env() -> {'/Path'}; + if ($path) { + $path =~ s/[\s\x00]+$//; + log("Old user path: $path\n"); + } else { + log("Old user path: none\n"); + } + my $mode = 'user'; + if (admin() && $multiuser) { + $mode = 'system'; + } + adjust_reg_path_for_texlive('add', $bindir, $mode); + $path = TeXLive::TLWinGoo::get_system_env() -> {'/Path'}; + $path =~ s/[\s\x00]+$//; + log("New system path: $path\n"); + $path = TeXLive::TLWinGoo::get_user_env() -> {'/Path'}; + if ($path) { + $path =~ s/[\s\x00]+$//; + log("New user path: $path\n"); + } else { + log("New user path: none\n"); + } +} + +sub w32_remove_from_path { + my ($bindir, $multiuser) = @_; + my $mode = 'user'; + if (admin() && $multiuser) { + $mode = 'system'; + } + adjust_reg_path_for_texlive('remove', $bindir, $mode); +} + + +=pod =item C<untar($tarfile,$targetdir, $remove_tarfile)> |