summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLConfFile.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-10-26 16:27:05 +0000
committerNorbert Preining <preining@logic.at>2010-10-26 16:27:05 +0000
commite9dbd753fa0f5419db47d3a4fc48eb056b337e1e (patch)
tree68ea96de73dbff2a3dc9eeabb108d052203d079a /Master/tlpkg/TeXLive/TLConfFile.pm
parent46cc0f2198d079f628f1112ee5edbacdee5d2ba3 (diff)
rename gui_expertmode to gui-expertmode, and allow for upgrading users
settings files git-svn-id: svn://tug.org/texlive/trunk@20215 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLConfFile.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLConfFile.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfFile.pm b/Master/tlpkg/TeXLive/TLConfFile.pm
index 2049b4c85bc..33ca89e55bf 100644
--- a/Master/tlpkg/TeXLive/TLConfFile.pm
+++ b/Master/tlpkg/TeXLive/TLConfFile.pm
@@ -125,6 +125,24 @@ sub value
return;
}
+sub rename_key
+{
+ my ($self, $oldkey, $newkey) = @_;
+ %config = %{$self{'confdata'}};
+ for my $i (0..$config{'lines'}) {
+ if (($config{$i}{'type'} eq 'data') &&
+ ($config{$i}{'key'} eq $oldkey)) {
+ $config{$i}{'key'} = $newkey;
+ }
+ }
+ if (defined($self{'keyvalue'}{$oldkey})) {
+ $self{'keyvalue'}{$newkey} = $self{'keyvalue'}{$oldkey};
+ delete $self{'keyvalue'}{$oldkey};
+ $self{'keyvalue'}{$newkey}{'status'} = 'changed';
+
+ }
+}
+
sub is_changed
{
my $self = shift;
@@ -479,6 +497,11 @@ if the key is not set.
With two arguments changes (or adds) the key/value pair to the config
file and returns the I<new> value.
+=item B<< $conffile->rename_key($oldkey, $newkey) >>
+
+Renames a key from C<$oldkey> to C<$newkey>. It does not automatically
+save the new config file.
+
=item B<< $conffile->is_changed >>
Returns true (1) if some real change has happened in the configuration file,