summary refs log tree commit diff
path: root/pkgs/misc/tex/nix/copy-includes.pl
blob: 26a9ab9160221ca21d5bfbfa4be1d676d19f5475 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use strict;
use File::Basename;

sub createDirs;
sub createDirs {
    my $path = shift;
    return unless $path =~ /^(.*)\/([^\/]*)$/;
    print "$1 BLA $2\n";
    return if -d $1;
    createDirs $1;
    mkdir $1 or die "cannot create directory `$1'";
}

for (my $n = 0; $n < @ARGV; $n += 2) {
    my $fullPath = $ARGV[$n];
    my $relPath = $ARGV[$n + 1];

    createDirs $relPath;
        
    symlink $fullPath, $relPath or die "cannot create symlink `$relPath'";
}