runner.pm: use dirname() in singletest_prepare()

Replacing a regex, for portability.

Reported-by: Stefan Eissing
Bug: https://github.com/curl/curl/issues/17871#issuecomment-3051830614

Cherry-picked from #17877
Closes #17900
This commit is contained in:
Viktor Szakats 2025-07-11 15:07:16 +02:00
parent af81e8fe5f
commit 245783338c
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View file

@ -38,6 +38,8 @@ use strict;
use warnings;
use 5.006;
use File::Basename;
BEGIN {
use base qw(Exporter);
@ -765,9 +767,7 @@ sub singletest_prepare {
my $fileContent = join('', @inputfile);
# make directories if needed
my $path = $filename;
# cut off the file name part
$path =~ s/^(.*)\/[^\/]*/$1/;
my $path = dirname($filename);
my @ldparts = split(/\//, $LOGDIR);
my $nparts = @ldparts;
my @parts = split(/\//, $path);