Skip to content

Commit fe345e9

Browse files
committed
make directories a build dep
1 parent e1e4d71 commit fe345e9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

htmlify.p6

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ sub MAIN(
160160
$proc = Proc::Async.new($coffee-exe, './highlights/highlight-filename-from-stdin.coffee', :r, :w);
161161
$proc-supply = $proc.stdout.lines;
162162
}
163-
say 'Creating html/subdirectories ...';
164163

165164
for <programs type language routine images syntax> {
166-
mkdir "html/$_" unless "html/$_".IO ~~ :e;
165+
Build::Dependency::require(
166+
'directory', "html/$_"
167+
);
167168
}
168169

169170
my $*DR = Perl6::Documentable::Registry.new;

lib/Build/Dependency.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@ multi sub require('executable', $exec-name, :$suggest) {
77
die "Could not find $exec-name. Did you `$suggest`?";
88
}
99
}
10+
11+
multi sub require('directory', $dir-name, :$create) {
12+
13+
my $io = $dir-name.IO;
14+
15+
return if $dir-name.IO ~~ :d;
16+
17+
if $dir-name.IO ~~ :e {
18+
die "$dir-name already exists, but isn't a directory.";
19+
}
20+
21+
note "Creating $dir-name";
22+
mkdir $dir-name;
23+
}

0 commit comments

Comments
 (0)