--- a/common/tools/listdir.pl Wed May 20 14:26:55 2009 +0100
+++ b/common/tools/listdir.pl Fri May 29 17:20:47 2009 +0100
@@ -1,14 +1,31 @@
#!perl -w
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Recursive listing of a directory, outputting lower-cased relative paths with unix dir separators
+
use strict;
my $dir = shift or die "Usage: $0 <dir> \n"; # provided dir to traverse
my $filelist = [];
+my $init = $dir = lc($dir);
+$init =~ s{\\}{\\\\};
# fwd declaration to prevent warning
sub recursedir($$);
# run recurse and print
recursedir ($dir, $filelist);
+
print $_, "\n" for(@$filelist);
sub recursedir($$) {
@@ -19,15 +36,14 @@
if(opendir(DIR, "$dir")) {
# list dir
for my $file(grep { !/^\./ } readdir DIR) {
- if(-d "$dir\\$file") {
+ if(-d "$dir/$file") {
# traverse subdirs
- recursedir("$dir\\$file", $list);
+ recursedir("$dir/$file", $list);
}
- elsif(-f "$dir\\$file") {
- # if file then swap (any present) fwd to bkslash and add to list
- $dir =~s/\//\\/;
- $file =~s/\//\\/;
- push @$list, "$dir\\$file";
+ elsif(-f "$dir/$file") {
+ my $formatted = lc($dir)."/".lc($file);
+ $formatted =~ s!$init/!!;
+ push @$list, $formatted;
}
}
closedir DIR;