blob: 1b7f0c9b0d5abb0d2300f3b3741c4cb2a6943e97 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/perl -w
use v5.16;
use File::Spec;
use File::Path qw(make_path);
# [fdl]
while (<>) {
if (/^f:(.*?)(?::(\d+))?(?::(\d+))?$/) {
my $path = $1;
my ($_volume, $dir, $_base) = File::Spec->splitpath($path);
my $size = $2 || 0;
my $mode = $3 ? oct($3) : 0644;
make_path($dir) if $dir;
open(my $out, ">", "$path") or die "can't create $path";
chmod($mode, $out);
truncate($out, $size);
close($out);
} elsif (/^d:(.*)$/) {
make_path($1, {mode => 0755});
} elsif (/^l:(.*?):(.*)$/) {
my $target = $1;
my $linkname = $2;
my ($_volume, $dir, $_base) = File::Spec->splitpath($linkname);
make_path($dir) if $dir;
symlink $target, $linkname;
}
}
|