summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index edffe918757..b1cfe76d1ea 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -286,17 +286,19 @@ values as environment variable and returns the result.
=cut
+sub expand_env {
+ my $key = shift;
+ foreach my $k (keys %ENV) {
+ return $ENV{$k} if (uc($k) eq uc($key));
+ }
+
+ return "%$key%";
+}
+
sub expand_string {
$s = shift @_;
- while ($s =~ /^([^%]*)%([^%]+)%(.*)$/) {
- foreach $k (keys %ENV) {
- if (uc($k) eq uc($2)) {
- $s = $1 . $ENV{$k} . $3;
- last;
- }
- }
- }
- $s;
+ $s =~ s/%([^%;]+)%/expand_env($1)/eg;
+ return $s;
}
=pod