* Support references to parent directories, e.g., \input{../../macros.ltx}.

svn path=/nixpkgs/trunk/; revision=3748
This commit is contained in:
Eelco Dolstra 2005-08-30 13:10:30 +00:00
parent c27109efa0
commit 860e14cd3d
2 changed files with 28 additions and 4 deletions

View file

@ -5,11 +5,32 @@ sub createDirs;
sub createDirs {
my $path = shift;
return unless $path =~ /^(.*)\/([^\/]*)$/;
return if -d $1;
createDirs $1;
mkdir $1 or die "cannot create directory `$1'";
my $dir = $1;
return if -d $dir;
return if -e $dir;
createDirs $dir;
mkdir $dir or die "cannot create directory `$dir'";
}
my $maxParents = 0;
for (my $n = 0; $n < @ARGV; $n += 2) {
my $fullPath = $ARGV[$n];
my $relPath = $ARGV[$n + 1];
my $parents = 0;
foreach my $comp (split /\//, $relPath) {
$parents++ if ($comp eq "..")
}
$maxParents = $parents if $parents > $maxParents;
}
my $startDir = "./";
for (my $n = 0; $n < $maxParents; $n++) {
$startDir .= "dotdot/";
mkdir "$startDir" or die "cannot create directory `$startDir': $!";
}
chdir $startDir or die;
for (my $n = 0; $n < @ARGV; $n += 2) {
my $fullPath = $ARGV[$n];
my $relPath = $ARGV[$n + 1];
@ -18,3 +39,5 @@ for (my $n = 0; $n < @ARGV; $n += 2) {
symlink $fullPath, $relPath or die "cannot create symlink `$relPath'";
}
print "$startDir\n";

View file

@ -2,7 +2,8 @@
ensureDir $out
perl $copyIncludes $includes
startDir=$(perl $copyIncludes $includes)
cd $startDir
for i in $extraFiles; do
if test -d $i; then