From e9dbd753fa0f5419db47d3a4fc48eb056b337e1e Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 26 Oct 2010 16:27:05 +0000 Subject: 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 --- Master/tlpkg/TeXLive/TLConfFile.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Master/tlpkg/TeXLive/TLConfFile.pm') 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 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, -- cgit v1.2.3