make locateSyncProfile() a "tad" less convoluted

Change-Id: I261b6c6b42bed576edb8a1d8420da19d34bd87a1
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-01-23 15:04:53 +01:00 committed by Qt by Nokia
parent 0abc98847d
commit cd2a2251d1

View File

@ -607,22 +607,14 @@ sub loadSyncProfile {
sub locateSyncProfile
{
my ($directory) = @_;
my $syncprofile;
$directory = abs_path($directory);
while(!defined $syncprofile) {
local(*D);
if (opendir(D, $directory)) {
foreach my $file (sort readdir(D)) {
next if ($file =~ /^\.\.?$/);
$syncprofile = "$directory/$file" if ($file =~ /^sync\.profile$/);
last if (defined $syncprofile);
}
closedir(D);
}
last if (defined $syncprofile || $directory eq "/" || $directory =~ /^?:[\/\\]$/);
while (1) {
my $file = $directory."/sync.profile";
return $file if (-e $file);
my $odir = $directory;
$directory = dirname($directory);
return undef if ($directory eq $odir);
}
return $syncprofile;
}
# check if this is an in-source build, and if so use that as the basedir too