3
# The contents of this file are subject to the Mozilla Public
4
# License Version 1.1 (the "License"); you may not use this file
5
# except in compliance with the License. You may obtain a copy of
6
# the License at http://www.mozilla.org/MPL/
8
# Software distributed under the License is distributed on an "AS
9
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
# implied. See the License for the specific language governing
11
# rights and limitations under the License.
13
# The Original Code is Mozilla Navigator.
15
# The Initial Developer of the Original Code is Netscape Communications
16
# Corp. Portions created by Netscape Communications Corp. are
17
# Copyright (C) 1998, 1999, 2000, 2001 Netscape Communications Corp. All
21
# Sean Su <ssu@netscape.com>
32
print "searching for longfilenames in:\n";
36
$start_dir = $ARGV[0];
37
$start_dir =~ s/\\/\//g;
39
if(substr($start_dir, -1, 1) ne '/')
41
$start_dir = $start_dir . "/";
44
($MOZ_TOOLS = $ENV{"MOZ_TOOLS"}) =~ s/\\/\//g;
46
# Open the output file
47
open(fpOutFile, ">>$outFile") || die "\nCould not open $outFile: $!\n";
49
# $rv has the following possible values:
50
# 0 - Found at least one long filename file
51
# 1 - Error locating GetShortPathName.exe
52
# 2 - No long filename file found
53
$rv = check_dir_structure($ARGV[0]);
60
sub check_dir_structure
63
my($foundFirstFile) = 2; # This var is also used as a return value:
64
# 0 - Found at least one long filename file
65
# 1 - Error locating GetShortPathName.exe
66
# 2 - No long filename file found
69
$save_cwd =~ s/\\/\//g;
70
if((-e "$curr_dir") && (-d "$curr_dir"))
72
$foundFirstFile = check_all_dir($curr_dir, $foundFirstFile);
81
print "$curr_dir does not exist!";
83
elsif(!(-d "$curr_dir"))
86
print "$curr_dir is not a valid directory!";
90
# print out the closing brace for the last file written out.
91
if($foundFirstFile == 0)
93
# at least one file was found
94
# print the "];\n" for the previous file found.
95
print fpOutFile "];\n";
98
return($foundFirstFile);
103
my($curr_dir, $foundFirstFile) = @_;
109
foreach $file (@dirlist)
114
$foundFirstFile = check_all_dir($file, $foundFirstFile);
118
if(check_extension($file))
120
$short_filename = `$MOZ_TOOLS/bin/GetShortPathName.exe $file`;
123
print "$MOZ_TOOLS/bin/GetShortPathName.exe: $!\n";
127
if(!($file =~ /$short_filename/i))
129
if($foundFirstFile == 0)
131
# at least one file was found
132
# print the ",\n" for the previous file found.
133
print fpOutFile ",\n";
137
# perl has problems dealing with '\\''s in split(), so we need to
138
# convert them to '/''s.
139
$curr_path =~ s/\\/\//g;
140
@relative_path = split(/$start_dir/,$curr_path);
141
if($relative_path[1] eq "")
143
print_file($file, $foundFirstFile);
147
print_file("$relative_path[1]/$file", $foundFirstFile);
155
return($foundFirstFile);
162
@listExtension = ("dll",
167
@arrayExtension = split(/\./,$file);
168
$extension = @arrayExtension[$#arrayExtension];
169
foreach $var (@listExtension)
171
if($extension eq $var)
181
my($file, $foundFirstFile) = @_;
186
print fpOutFile "// This list contains filenames that are long filenames ( > 8.3) critical during installation time.\n";
187
print fpOutFile "// This list is automatically generated during the build process.\n";
188
print fpOutFile "// The filenames should include paths relative to the Netscape 6 folder.\n";
189
print fpOutFile "// '/' must be used as path delimiters regardless of platform.\n";
190
print fpOutFile "var listLongFilePaths = [\"$file\"";
194
# middle file in list
195
print fpOutFile " \"$file\"";
201
print "\n usage: $0 <dir> <outfile>\n";
202
print "\n dir - full path to look for files\n";
203
print " outfile - file to append to\n";