SVN: vfmg/trunk/vfmg

sparky sparky at pld-linux.org
Mon Dec 4 04:23:13 CET 2006


Author: sparky
Date: Mon Dec  4 04:23:11 2006
New Revision: 8053

Modified:
   vfmg/trunk/vfmg
Log:
- remove yet more about icons
- move 'search dirs' before require SOMETHING_out


Modified: vfmg/trunk/vfmg
==============================================================================
--- vfmg/trunk/vfmg	(original)
+++ vfmg/trunk/vfmg	Mon Dec  4 04:23:11 2006
@@ -1,5 +1,7 @@
 #!/usr/bin/perl -w
 # $Id$
+#
+# what is $DESKTOP_FILE_PATH?
 
 use strict;
 use Getopt::Long qw(GetOptions :config bundling);
@@ -157,6 +159,50 @@
 
 die "Missing argument {".wms()."}\n" unless exists $ARGV[0];
 
+# search dirs {{{
+our @xdg_data_dirs = grep -d,
+  ( exists $ENV{'XDG_DATA_HOME'}
+	? $ENV{'XDG_DATA_HOME'}
+	: "$ENV{'HOME'}/.local/share"
+  ),
+  ( exists $ENV{'XDG_DATA_DIRS'}
+	? split /:+/, $ENV{'XDG_DATA_DIRS'}
+	: qw(/usr/local/share /usr/share)
+  );
+
+my @xdg_config_dirs = map { "$_/menus" } grep -d,
+  ( exists $ENV{'XDG_CONFIG_HOME'}
+	? $ENV{'XDG_CONFIG_HOME'}
+	: "$ENV{'HOME'}/.config"
+  ),
+  ( exists $ENV{'XDG_CONFIG_DIRS'}
+	? split /:+/, $ENV{'XDG_CONFIG_DIRS'}
+	: qw(/etc/xdg)
+  );
+
+my @path;
+if ( $opt{exec} ) {
+	@path = (grep (-d, split(/:+/,$ENV{'PATH'})), "");
+	if( length $opt{xterm} ) {
+		my $exists = 0;
+		my $bin = $opt{xterm};
+		$bin =~ s/(\S+).*/$1/;
+		foreach my $dir (@path) {
+			if (-x "$dir/$bin") {
+				$exists = 1;
+				$opt{xterm} = "$dir/$opt{xterm}" if $opt{exec_full};
+				last;
+			}
+		}
+		unless ($exists) {
+			$opt{xterm} = "";
+			warn "Can't find $bin.",
+				" Terminal applications will not be included.\n";
+		}
+	}
+}
+# search dirs }}}
+
 $o_output = $ARGV[0];
 require "VFMG/${o_output}_out.pm"; # for testing
 eval { require "VFMG/${o_output}_out.pm" }
@@ -195,8 +241,7 @@
 
 # check dependencies
 $opt{exec} = 1 if $opt{exec_full};
-eval { VFMG::Icons::preconf() }
-	or $opt{icons_ext} = 0;
+eval { VFMG::Icons::preconf() };
 $opt{encoding} = "utf8" if $opt{utf};
 unless (length $opt{destdir}) {
 	eval { $opt{destdir} = VFMG::Output::destdir() }
@@ -208,61 +253,6 @@
 }
 # header }}}
 
-# search dirs {{{
-my @xdg_data_dirs = grep -d,
-  ( exists $ENV{'XDG_DATA_HOME'}
-	? $ENV{'XDG_DATA_HOME'}
-	: "$ENV{'HOME'}/.local/share"
-  ),
-  ( exists $ENV{'XDG_DATA_DIRS'}
-	? split /:+/, $ENV{'XDG_DATA_DIRS'}
-	: qw(/usr/local/share /usr/share)
-  );
-
-my @xdg_config_dirs = map { "$_/menus" } grep -d,
-  ( exists $ENV{'XDG_CONFIG_HOME'}
-	? $ENV{'XDG_CONFIG_HOME'}
-	: "$ENV{'HOME'}/.config"
-  ),
-  ( exists $ENV{'XDG_CONFIG_DIRS'}
-	? split /:+/, $ENV{'XDG_CONFIG_DIRS'}
-	: qw(/etc/xdg)
-  );
-
-my @icondirs = (
-	grep (-d,
-		"$ENV{'HOME'}/.icons/",
-		map({"$_/icons/"} @xdg_data_dirs),
-		qw(/usr/share/pixmaps/
-		  /usr/share/icons/default.kde/48x48/apps/
-		  /usr/share/icons/hicolor/48x48/apps/)
-	),
-	'',
-);
-
-my @path;
-if ( $opt{exec} ) {
-	@path = (grep (-d, split(/:+/,$ENV{'PATH'})), "");
-	if( length $opt{xterm} ) {
-		my $exists = 0;
-		my $bin = $opt{xterm};
-		$bin =~ s/(\S+).*/$1/;
-		foreach my $dir (@path) {
-			if (-x "$dir/$bin") {
-				$exists = 1;
-				$opt{xterm} = "$dir/$opt{xterm}" if $opt{exec_full};
-				last;
-			}
-		}
-		unless ($exists) {
-			$opt{xterm} = "";
-			warn "Can't find $bin.",
-				" Terminal applications will not be included.\n";
-		}
-	}
-}
-# search dirs }}}
-
 # get locale (for Name[*]) {{{
 my @lang;
 sub addlang {
@@ -296,8 +286,6 @@
 	return (grep !/\[.*\]$/, @{$in})[0];
 } # }}}
 
-# what is $DESKTOP_FILE_PATH?
-
 my @apps;	# $apps{name}{category}=[icon,exec]
 our @desktop;
 my @decode_tags = qw(Name);
@@ -377,22 +365,7 @@
 		s/%2/$tags{Exec}/g;
 		$tags{Exec} = $_;
 	}
-	$tags{Icon} = $tags{file} unless $tags{Icon};
-	if ( $opt{icons_ext} ) {
-		my $exists = 0;
-		ALLDIRS: foreach my $dir (@icondirs) {
-			foreach my $ext ('', qw(.svg .xpm .png)) {
-				if (-f $dir . $tags{Icon} . $ext) {
-					$tags{Icon} .= $ext;
-					$tags{Icon} = $dir . $tags{Icon} if $opt{icons_full};
-					$exists = 1;
-					last ALLDIRS;
-				}
-			}
-		}
-		$tags{Icon} = '' unless $exists;
-	}
-	
+
 	$tags{Encoding} = exists $tags{Encoding} ? $tags{Encoding} : 'iso-8859-1';
 	
 	foreach my $tag_name (@decode_tags) {
@@ -449,7 +422,6 @@
 	}
 	
 	push @desktop, \%tags;
-	#[$tags{file}, $tags{Name}, $tags{Icon}, $tags{Exec}, $tags{GenericName}, $tags{term}, $tags{bin}];
 	
 	$apps[$#desktop]{$_} = 1    # two apps can have same names now:)
 	  foreach grep length, split /;+/, $tags{Categories};
@@ -684,21 +656,6 @@
 				$dname = $tags{findfirstlang( \@name )};
 				$ok = 1;
 				
-				if($opt{icons_ext}) {
-					my $exists = 0;
-					ALLDIRS: foreach my $dir (@icondirs) {
-						foreach my $ext ('', qw(.svg .xpm .png)) {
-							if (-f $dir . $tags{Icon} . $ext) {
-								$tags{Icon} .= $ext;
-								$tags{Icon} = $dir . $tags{Icon}
-									if $opt{icons_full};
-								$exists = 1;
-								last ALLDIRS;
-							}
-						}
-					}
-					$tags{Icon} = '' unless $exists;
-				}
 				if ( length $dname ) {
 					$tags{Name} = decode($tags{Encoding},$dname);
 					unless($tags{Name}) {
@@ -711,7 +668,6 @@
 				}
 				($tags{file} = $dirfile) =~ s/\..*?$//;
 				$desktop[$dirnum] = \%tags;
-				#[$tags{file}, $tags{Name}, $tags{Icon}];
 				last;
 			}
 			unless ($ok) {


More information about the pld-cvs-commit mailing list