From 52b3387a71997c55432c21f55b1fb97e8d5435fd Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Wed, 17 Aug 2005 09:39:54 +0000 Subject: [PATCH] Fix native Windows zip build regression from bug 192688 r=bsmedberg --- config/make-jars.pl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/config/make-jars.pl b/config/make-jars.pl index 95fac52c4608..7a46b3256721 100644 --- a/config/make-jars.pl +++ b/config/make-jars.pl @@ -80,9 +80,6 @@ my $jarDir = $chromeDir; if (defined($::opt_j)) { $jarDir = $::opt_j; } -if ($jarDir !~ /^\//) { - $jarDir = getcwd() . '/' . $jarDir; -} my $verbose = 0; if (defined($::opt_v)) { @@ -218,7 +215,10 @@ sub JarIt { my ($destPath, $jarPath, $jarfile, $args, $overrides) = @_; my $oldDir = cwd(); - my $jarchive = $jarPath . '/' . $jarfile . '.jar'; + my @destPath = _moz_splitpath("$destPath/$jarfile"); + my @jarchive = _moz_splitpath("$jarPath/$jarfile.jar"); + shift @destPath, shift @jarchive while $destPath[0] eq $jarchive[0]; + my $jarchive = "../" x @destPath . join("/", @jarchive); chdir("$destPath/$jarfile"); if ("$fileformat" eq "flat" || "$fileformat" eq "symlink") { @@ -288,6 +288,17 @@ sub JarIt #print "cd $oldDir\n"; } +sub _moz_splitpath +{ + my ($path) = @_; + my @dirs = split(m:/:, $path); + foreach (reverse 0 .. $#dirs) { + splice(@dirs, $_, 1) if $dirs[$_] eq "."; + splice(@dirs, $_, 2) if $dirs[$_] eq ".."; + } + return @dirs; +} + sub _moz_rel2abs { my ($path, $keep_file) = @_;