From 16518fa0b5a5024da53ce743c1a4d5f6af07867b Mon Sep 17 00:00:00 2001 From: Juergen Schmidt Date: Mon, 1 Nov 2010 11:08:24 +0100 Subject: jsc331: i115310: correct resolveLink function --- odk/configure.pl | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/odk/configure.pl b/odk/configure.pl index 8f3778e8..a437ac0a 100755 --- a/odk/configure.pl +++ b/odk/configure.pl @@ -5,6 +5,7 @@ # use IO::File; +use File::Basename; $main::hostname= $ARGV[0]; $main::sdkpath= $ARGV[1]; @@ -35,7 +36,7 @@ if ( $main::operatingSystem =~ m/darwin/ ) { # $main::OO_SDK_URE_HOME = `cd $main::sdkpath/../ure-link && pwd`; } else { - $main::OO_SDK_URE_HOME = `cd $main::sdkpath/../../ure && pwd`; + $main::OO_SDK_URE_HOME = `cd $main::sdkpath/../ure-link && pwd`; } chomp($main::OO_SDK_URE_HOME); @@ -554,15 +555,26 @@ sub resolveLink { my $base= shift; my $link= shift; - my $linktarget = readlink "$base/$link"; + + my $resolvedpath = "$base/$link"; + my $linktarget = readlink "$resolvedpath"; my $resolvedlink = ""; while ( $linktarget ne "") { - $link = $linktarget; - $linktarget = readlink "$base/$link"; + + if ( $linktarget =~ m/^\/.*/ ) + { + $resolvedpath = "$linktarget"; + } else { + $resolvedpath = `cd $base/$linktarget; pwd`; + chop $resolvedpath; } + $base = dirname("$resolvedpath"); - $resolvedlink = `cd $base/$link; pwd`; + $linktarget = readlink "$resolvedpath"; + } + + $resolvedlink = `cd $resolvedpath; pwd`; chop $resolvedlink; return $resolvedlink; } @@ -578,6 +590,7 @@ sub searchprog { if ( $main::operatingSystem =~ m/darwin/ ) { $progDir = resolveLink("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK"); + if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) { return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; -- cgit v1.2.3