summaryrefslogtreecommitdiffstats
path: root/scripts/qt
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-04-27 14:50:31 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-27 06:55:00 +0200
commit3aaff8fe80e89cb34560d71cd5cde5310766ccf0 (patch)
treed75fdfc9a552a94ae8ed887de5fda07b28dbdc71 /scripts/qt
parentd76b80ad3d8a0e937bf0e090d2cd284a439608d0 (diff)
qtmod_test: fixed crash on Windows when qt.install.dir does not exist
Fix for difference in abs_path behavior on Unix vs Windows. Change-Id: I757e1c9f041dce2309e385a21034fdd2f6e3b29b Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Diffstat (limited to 'scripts/qt')
-rwxr-xr-xscripts/qt/qtmod_test.pl16
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;
}