diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2012-01-23 15:04:53 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-10 00:27:44 +0100 |
commit | cd2a2251d1a739b5d84f2543c280cf399eba47d0 (patch) | |
tree | 774d639b5c87200475ee1a586d41de60a3a1884e /bin | |
parent | 0abc98847d4e7c51486aabcac8b9fa59a7361d13 (diff) |
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>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/syncqt | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/bin/syncqt b/bin/syncqt index 15814df3f9..07b9d2432e 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -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 |