sbsv1_os/e32toolp/e32util/listfeaturevariants.pl
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     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 use strict;
       
    19 
       
    20 my $source = shift;
       
    21 
       
    22 # list invariant
       
    23 print "$source\n" if (-f $source);
       
    24 
       
    25 # now think about variants
       
    26 
       
    27 use File::Basename;
       
    28 my $srcDir = dirname($source);
       
    29 my $srcRoot = basename($source);
       
    30 my $srcExt = "";
       
    31 
       
    32 if ($srcRoot =~ /^(.+)\.([^\.]+)$/)
       
    33 {
       
    34 	$srcRoot = $1;
       
    35 	$srcExt = $2;
       
    36 }
       
    37 
       
    38 opendir(DIR, $srcDir) or die("ERROR: cannot read directory $srcDir\n");
       
    39 
       
    40 # list all variants
       
    41 while (my $file = readdir(DIR))
       
    42 {
       
    43 	print "$srcDir\\$file\n" if ($file =~ /^$srcRoot\.(\w{32})\.$srcExt$/i);
       
    44 }
       
    45 
       
    46 exit 1 if (!closedir(DIR));
       
    47 exit 0;
       
    48