diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-02-29 16:02:26 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-02-29 16:02:26 +0000 |
commit | f79f8dc28a02eb586b4cb2eecfe693a201c0725c (patch) | |
tree | 5b6b7d8e9a07b4bd980e799660a42995533eb1bf /Master/tlpkg/TeXLive | |
parent | 2b049d253dc2dfcbddc656ee3bffedf9f65a67b2 (diff) |
TeXLive::TLWinGoo::dir_writable now also works for Vista.
git-svn-id: svn://tug.org/texlive/trunk@6774 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLWinGoo.pm | 70 |
1 files changed, 28 insertions, 42 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 95e41aa4ef8..2bb9384b2a8 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -208,19 +208,15 @@ sub dir_writable { return 0 unless -d $d; $d =~ s!\\!/!g; $d =~ s!/$!!g; - my $i=0; + my $i = 0; while (-e $d . "/" . $i) { $i++; } my $f = $d."/".$i; - #print $f."\n"; - return 0 unless open TEST, ">".$f; - my $written = 0; - $written = (print TEST "\n"); - close TEST; - # -s: non-zero size - # -e (exists) is not good enough - return 0 unless -s $f; - unlink $f; - return $written; + my $fb = $f; + $fb =~ s!/!\\!g; + return 0 if + system('copy /b ' . $ENV{'COMSPEC'} . ' "' . $fb . '" >nul 2>&1'); + unlink $f if -e $f; + return 1; } =pod @@ -368,26 +364,26 @@ sub add_texbindir_to_path { my $d; my $d_exp; my $found = 0; - my @newp; + my @newpt; my $newp; # system path if ($is_admin) { - @newp = (); + @newpt = (); foreach $d (split (';', get_system_path())) { $d_exp = expand_string($d); $d_exp =~ s/\\/\//g; $d_exp =~ s/\/$//; if (uc($d_exp) eq uc($texbindir)) { - push @newp, $d unless $found; + push @newpt, $d unless $found; $found = 1; } elsif (!is_a_texdir($d_exp)) { - push @newp, $d; + push @newpt, $d; } } - push @newp, $texbindir unless $found; + push @newpt, $texbindir unless $found; $found = 1; - $newp = join (';', @newp); + $newp = join (';', @newpt); $newp =~ s/\//\\/g; $system_env->ArrayValues(1); # use value_data, value_type pairs $system_env -> {"/Path"} = [ $newp, REG_EXPAND_SZ ]; @@ -409,21 +405,21 @@ sub add_texbindir_to_path { } # user path - @newp = (); + @newpt = (); foreach $d (split (';', get_user_path())) { $d_exp = expand_string($d); $d_exp =~ s/\\/\//g; $d_exp =~ s/\/$//; if (uc($d_exp) eq uc($texbindir)) { - push @newp, $d unless $found; # admin case: always $found + push @newpt, $d unless $found; # admin case: always $found $found = 1; } elsif (!is_a_texdir($d_exp)) { - push @newp, $d; + push @newpt, $d; } } - push @newp, $texbindir unless $found; - if (@newp) { - $newp = join ';', @newp; + push @newpt, $texbindir unless $found; + if (@newpt) { + $newp = join ';', @newpt; $newp =~ s/\//\\/g; $user_env->ArrayValues(1); # use value_data, value_type pairs $user_env -> {"/Path"} = [ $newp, @@ -438,42 +434,39 @@ sub remove_texbindirs_from_path { my $system_env = get_system_env(); my $user_env = get_user_env(); - my $d; - my $d_exp; - my @newp; - my $newp; + my ($d, $d_exp, @newpt, $newp); # system path if ($is_admin) { - @newp = (); + @newpt = (); foreach $d (split (';', get_system_path())) { $d_exp = expand_string($d); $d_exp =~ s/\\/\//g; $d_exp =~ s/\/$//; - push @newp, $d unless is_a_texdir($d_exp); + push @newpt, $d unless is_a_texdir($d_exp); } - $newp = join (';', @newp); + $newp = join (';', @newpt); $newp =~ s/\//\\/g; $system_env->ArrayValues(1); # use value_data, value_type pairs $system_env -> {"/Path"} = [ $newp, REG_EXPAND_SZ ]; } # user path - @newp = (); + @newpt = (); foreach $d (split (';', get_user_path())) { $d_exp = expand_string($d); $d_exp =~ s/\\/\//g; $d_exp =~ s/\/$//; - push @newp, $d unless is_a_texdir($d_exp); + push @newpt, $d unless is_a_texdir($d_exp); } - if (@newp) { - $newp = join(';', @newp); + if (@newpt) { + $newp = join(';', @newpt); $newp =~ s/\//\\/g; $user_env->ArrayValues(1); # use value_data, value_type pairs $user_env -> {"/Path"} = [ $newp, ($newp =~ /%/) ? REG_EXPAND_SZ : REG_SZ ]; } else { - delete $user_env -> {'/Path'}; + delete $user_env -> {"/Path"}; } } @@ -706,10 +699,3 @@ sub update_assocs() { 1; __END__ - -http://www.robvanderwoude.com/rundll.html: - -Activate registry changes in HKEY_CURRENT_USER without logging off -(Windows 2000 and later): - -RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True |