diff options
Diffstat (limited to 'scripts/qt')
-rwxr-xr-x | scripts/qt/qtmod_test.pl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/qt/qtmod_test.pl b/scripts/qt/qtmod_test.pl index a51f079c..2bd26588 100755 --- a/scripts/qt/qtmod_test.pl +++ b/scripts/qt/qtmod_test.pl @@ -225,13 +225,25 @@ sub safe_abs_path { my ($self, $path) = @_; - my $abs_path = abs_path( $path ); - if (!$abs_path) { + # On Windows, abs_path dies if $path doesn't exist. + # On Unix, it is OK if $path doesn't exist, as long as dirname($path) exists. + # Adjust the lookup to get the same behavior on both platforms. + my $end; + if (! -e $path) { + ($end, $path) = fileparse( $path ); + } + + my $abs_path = eval { abs_path( $path ) }; + if ($@ || !$abs_path) { $self->fatal_error( "path '$path' unexpectedly does not exist (while in directory: $CWD)" ); } + if ($end) { + $abs_path = catfile( $abs_path, $end ); + } + return $abs_path; } |