Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix some issues in findClosestExistingPath
- Loading branch information
Showing
with
6 additions
and
2 deletions.
-
+6
−2
src/core/qgsfileutils.cpp
|
@@ -110,7 +110,7 @@ QString QgsFileUtils::findClosestExistingPath( const QString &path ) |
|
|
QSet< QString > visited; |
|
|
while ( !currentPath.exists() ) |
|
|
{ |
|
|
const QString parentPath = QDir::cleanPath( currentPath.path() + QStringLiteral( "/.." ) ); |
|
|
const QString parentPath = QDir::cleanPath( currentPath.absolutePath() + QStringLiteral( "/.." ) ); |
|
|
if ( visited.contains( parentPath ) ) |
|
|
return QString(); // break circular links |
|
|
|
|
@@ -120,6 +120,10 @@ QString QgsFileUtils::findClosestExistingPath( const QString &path ) |
|
|
visited << parentPath; |
|
|
} |
|
|
|
|
|
const QString res = QDir::cleanPath( currentPath.path() ); |
|
|
const QString res = QDir::cleanPath( currentPath.absolutePath() ); |
|
|
|
|
|
if ( res == QDir::currentPath() ) |
|
|
return QString(); // avoid default to binary folder if a filename alone is specified |
|
|
|
|
|
return res == '.' ? QString() : res; |
|
|
} |