sbsv1/abld/e32util/listfeaturevariants.pl
changeset 607 378360dbbdba
parent 599 fa7a3cc6effd
equal deleted inserted replaced
591:22486c9c7b15 607:378360dbbdba
       
     1 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # list A.X.aaa for all X (32 chars) when given A.aaa
       
    15 # 
       
    16 #
       
    17 
       
    18 
       
    19 my $source = shift;
       
    20 
       
    21 # list invariant
       
    22 print "$source\n" if (-f $source);
       
    23 
       
    24 # now think about variants
       
    25 
       
    26 use File::Basename;
       
    27 my $srcDir = dirname($source);
       
    28 my $srcRoot = basename($source);
       
    29 my $srcExt = "";
       
    30 
       
    31 if ($srcRoot =~ /^(.+)\.([^\.]+)$/)
       
    32 {
       
    33 	$srcRoot = $1;
       
    34 	$srcExt = $2;
       
    35 }
       
    36 
       
    37 opendir(DIR, $srcDir) or die("ERROR: cannot read directory $srcDir\n");
       
    38 
       
    39 # list all variants
       
    40 while (my $file = readdir(DIR))
       
    41 {
       
    42 	print "$srcDir\\$file\n" if ($file =~ /^$srcRoot\.(\w{32})\.$srcExt$/i);
       
    43 }
       
    44 
       
    45 exit 1 if (!closedir(DIR));
       
    46 exit 0;
       
    47