vfmg (DEVEL): vfmg - parse directory files in radek's way, not fas...
sparky
sparky at pld-linux.org
Mon Oct 31 16:07:12 CET 2005
Author: sparky Date: Mon Oct 31 15:07:12 2005 GMT
Module: vfmg Tag: DEVEL
---- Log message:
- parse directory files in radek's way, not faster but I like it
---- Files affected:
vfmg:
vfmg (1.73.2.11 -> 1.73.2.12)
---- Diffs:
================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.11 vfmg/vfmg:1.73.2.12
--- vfmg/vfmg:1.73.2.11 Mon Oct 31 15:45:43 2005
+++ vfmg/vfmg Mon Oct 31 16:07:07 2005
@@ -496,31 +496,24 @@
my $ok=0;
foreach my $tmp (@tmp) {
open F_IN, "$tmp$dirfile" or next;
- while(<F_IN>) {
- if (/^\s*Name\s*=\s*(.+?)\s*$/ && $lang<1) {
- $dname=$1;
- }
- if (/^\s*Name\[$lang1\]\s*=\s*(.+?)\s*$/ && $lang<2) {
- $dname=$1;
- $lang=1;
- }
- if (/^\s*Name\[$lang2\]\s*=\s*(.+?)\s*$/ && $lang<3) {
- $dname=$1;
- $lang=2;
- }
- if (/^\s*Name\[$lang3\]\s*=\s*(.+?)\s*$/ && $lang<4) {
- $dname=$1;
- $lang=3;
- }
- if (/^\s*Name\[$lang4\]\s*=\s*(.+?)\s*$/ && $lang<5) {
- $dname=$1;
- $lang=4;
- }
- $icon=$1 if /^\s*Icon\s*=\s*(.+?)\s*$/;
- $enc=$1 if /^\s*Encoding\s*=\s*(.+?)\s*$/;
- }
+ my %tags = (
+ Name => '',
+ Icon => '',
+ map {
+ ## "foo = bar" or "Name[baz] = bar"
+ /^\s*
+ (Name(?:\[(?:$lang4|$lang3|$lang2|$lang1)\])?
+ |Icon|Encoding)
+ \s* = \s* (.+?)
+ \s*$/ox
+ } <F_IN>,
+ );
+ $dname = $tags{(sort { length $b <=> length $a } grep /^Name/, keys %tags)[0]};
+ $icon = $tags{Icon};
+ $enc = $tags{Encoding};
close F_IN;
- $ok=1; last;
+ $ok=1;
+ last;
}
if ($ok) {
if($o_icons) {
================================================================
---- CVS-web:
http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.11&r2=1.73.2.12&f=u
More information about the pld-cvs-commit
mailing list