From 29f1b9e85df59ab52b5d45bd3db0d2ec80612289 Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Wed, 13 Oct 2021 14:16:34 +0100 Subject: [PATCH] [CI] Reduce dependencies of warning filter script --- scripts/warnings.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/warnings.pl b/scripts/warnings.pl index b47990eef..4c3dc138c 100644 --- a/scripts/warnings.pl +++ b/scripts/warnings.pl @@ -16,7 +16,8 @@ use strict; use warnings; -use Path::Class; +use File::Spec; +use Cwd; my %cmds; while (<<>>) @@ -24,7 +25,8 @@ while (<<>>) chomp; my %result = extractWarning($_); next if not %result; - $result{file} = toRelativePath($result{file})->as_foreign('Unix'); + $result{file} = toRelativePath($result{file}); + $result{file} =~ s(\\)(/)g if $^O eq 'MSWin32'; if (exists $result{line}) { ++$cmds{"::warning file=$result{file},line=$result{line}::$result{msg}"}; } else { @@ -66,8 +68,7 @@ sub extractMsvcWarning sub toRelativePath { my $path = shift; - my $file = file($path); - return $file if $file->is_relative; - return $file->relative if dir()->absolute()->subsumes($file); - return $file; + return $path if not File::Spec->file_name_is_absolute($path); + return File::Spec->rel2abs($path) if index($path, getcwd()) == 0; + return $path; }