Fix native Windows zip build regression from bug 192688 r=bsmedberg etc.

This commit is contained in:
neil%parkwaycc.co.uk 2005-08-24 19:47:43 +00:00
Родитель e34ec5f9df
Коммит 80c4045386
1 изменённых файлов: 13 добавлений и 15 удалений

Просмотреть файл

@ -80,9 +80,6 @@ my $jarDir = $chromeDir;
if (defined($::opt_j)) { if (defined($::opt_j)) {
$jarDir = $::opt_j; $jarDir = $::opt_j;
} }
if ($jarDir !~ /^\//) {
$jarDir = getcwd() . '/' . $jarDir;
}
my $verbose = 0; my $verbose = 0;
if (defined($::opt_v)) { if (defined($::opt_v)) {
@ -218,7 +215,7 @@ sub JarIt
{ {
my ($destPath, $jarPath, $jarfile, $args, $overrides) = @_; my ($destPath, $jarPath, $jarfile, $args, $overrides) = @_;
my $oldDir = cwd(); my $oldDir = cwd();
my $jarchive = $jarPath . '/' . $jarfile . '.jar'; my $jarchive = _moz_abs2rel("$jarPath/$jarfile.jar", "$destPath/$jarfile", 1);
chdir("$destPath/$jarfile"); chdir("$destPath/$jarfile");
if ("$fileformat" eq "flat" || "$fileformat" eq "symlink") { if ("$fileformat" eq "flat" || "$fileformat" eq "symlink") {
@ -234,7 +231,6 @@ sub JarIt
mozLock($lockfile) if (!$nofilelocks); mozLock($lockfile) if (!$nofilelocks);
if (!($args eq "")) { if (!($args eq "")) {
my $cwd = getcwd;
my $err = 0; my $err = 0;
#print "$zipprog $zipmoveopt -uX $jarchive $args\n"; #print "$zipprog $zipmoveopt -uX $jarchive $args\n";
@ -290,24 +286,26 @@ sub JarIt
sub _moz_rel2abs sub _moz_rel2abs
{ {
my ($path, $keep_file) = @_; my ($path, $isdir) = @_;
$path = File::Spec->rel2abs($path, $objdir); $path = File::Spec->catfile(getcwd, $path)
my ($volume, $dirs, $file) = File::Spec->splitpath($path); unless File::Spec->file_name_is_absolute($path);
my (@dirs) = reverse File::Spec->splitdir($dirs); my (@dirs) = reverse split(m:/:, File::Spec->canonpath($path));
shift @dirs unless $isdir;
my ($up) = File::Spec->updir(); my ($up) = File::Spec->updir();
foreach (reverse 0 .. $#dirs) { foreach (reverse 0 .. $#dirs) {
splice(@dirs, $_, 2) if ($dirs[$_] eq $up); splice(@dirs, $_, 2) if ($dirs[$_] eq $up);
} }
$dirs = File::Spec->catdir(reverse @dirs); return reverse @dirs;
return File::Spec->catpath($volume, $dirs, $keep_file && $file);
} }
sub _moz_abs2rel sub _moz_abs2rel
{ {
my ($target, $linkname) = @_; my ($target, $basedir, $isdir) = @_;
$target = _moz_rel2abs($target, 1); my (@target) = _moz_rel2abs($target, 1);
$linkname = _moz_rel2abs($linkname); my (@basedir) = _moz_rel2abs($basedir, $isdir);
return File::Spec->abs2rel($target, $linkname); shift @target, shift @basedir
while @target && @basedir && $target[0] eq $basedir[0];
return File::Spec->catfile((File::Spec->updir()) x @basedir, @target);
} }
sub UniqIt sub UniqIt