runtests: allow client/file to specify multiple directories

... and make sure to mkdir them all
This commit is contained in:
Daniel Stenberg 2022-01-02 22:22:14 +01:00
parent 2e6f83f051
commit 4432234aca
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -3976,6 +3976,20 @@ sub singletest {
return -1;
}
my $fileContent = join('', @inputfile);
# make directories if needed
my $path = $filename;
# cut off the file name part
$path =~ s/^(.*)\/[^\/]*/$1/;
my @parts = split(/\//, $path);
if($parts[0] eq "log") {
# the file is in log/
my $d = shift @parts;
for(@parts) {
$d .= "/$_";
mkdir $d; # 0777
}
}
open(OUTFILE, ">$filename");
binmode OUTFILE; # for crapage systems, use binary
if($fileattr{'nonewline'}) {