File indexing completed on 2024-04-14 03:59:17

0001 #!/usr/bin/perl -w
0002 
0003 use File::Path qw(make_path);
0004 
0005 #  WAS:
0006 #  in katomicrc
0007 #
0008 #    [Highscores_user]
0009 #    Level_1=15
0010 #
0011 #  NOW:
0012 #  in $DATA_DIR/highscores:
0013 #
0014 #    [Highscores_user][default_levels]
0015 #    Level1=15
0016 
0017 my $prefix=`kde4-config --localprefix`;
0018 
0019 chomp $prefix;
0020 
0021 if(length($prefix) > 0)
0022 {
0023     my $highscore_dir="$prefix/share/apps/katomic/";
0024     if(not -d $highscore_dir)
0025     {
0026         make_path($highscore_dir) or die $!;
0027     }
0028     open FILE, ">$highscore_dir/highscores" or die $!;
0029 
0030     my $firstHsGroup = 1;
0031     while( <> )
0032     {
0033         my $line = $_;
0034         chomp $line;
0035         if($line =~ /\[Highscores_/)
0036         {
0037             if(not $firstHsGroup)
0038             {
0039                 print FILE "\n";
0040             }
0041 
0042             print FILE "$line\[default_levels\]\n";
0043             $firstHsGroup = 0;
0044 
0045             # make kconf_update delete group from rc file
0046             print "# DELETEGROUP $line\n";
0047         }
0048         elsif($line =~ /Level_([0-9]+)=([0-9]+)/)
0049         {
0050             print FILE "Level$1=$2\n";
0051         }
0052     }
0053 }