diff options
Diffstat (limited to 'lib/WebCoso.pm')
-rw-r--r-- | lib/WebCoso.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/WebCoso.pm b/lib/WebCoso.pm index 5fe9a07..66fbf5f 100644 --- a/lib/WebCoso.pm +++ b/lib/WebCoso.pm @@ -16,7 +16,7 @@ class WebCoso { CATCH { when X::IO { } } - $base.child($dir).dir( + ( $dir ?? $base.child($dir) !! $base ).dir( test => /$basename \. .+? \. $ext/, ); } // (); @@ -30,10 +30,11 @@ class WebCoso { } method put-file($dir,$basename,$lang,$ext,$contents) { - my $t = $!tmpdir.child($dir); + my $t = ($dir ?? $!tmpdir.child($dir) !! $!tmpdir); $t.mkdir; - $t.child("{$basename}.{$lang}.{$ext}").spurt($contents); - return; + my $f = $t.child("{$basename}.{$lang}.{$ext}"); + $f.spurt($contents); + return $f; } method new-doc(:$dir) { |