forked from qt-creator/qt-creator
Utils: Improve FilePath::parentDir() for the remote case
QDir::cleanPath() should not be used on FilePath::toString'ed object, it removed the second slash in the :// separator. Change-Id: I0168d52f6d7caa99f5ccc5d1d93ae2bd783332c5 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -954,7 +954,7 @@ bool FilePath::needsDevice() const
|
|||||||
/// \returns \a FilePath with the last segment removed.
|
/// \returns \a FilePath with the last segment removed.
|
||||||
FilePath FilePath::parentDir() const
|
FilePath FilePath::parentDir() const
|
||||||
{
|
{
|
||||||
const QString basePath = toString();
|
const QString basePath = path();
|
||||||
if (basePath.isEmpty())
|
if (basePath.isEmpty())
|
||||||
return FilePath();
|
return FilePath();
|
||||||
|
|
||||||
@@ -966,7 +966,9 @@ FilePath FilePath::parentDir() const
|
|||||||
const QString parent = QDir::cleanPath(path);
|
const QString parent = QDir::cleanPath(path);
|
||||||
QTC_ASSERT(parent != path, return FilePath());
|
QTC_ASSERT(parent != path, return FilePath());
|
||||||
|
|
||||||
return FilePath::fromString(parent);
|
FilePath result = *this;
|
||||||
|
result.setPath(parent);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath FilePath::absolutePath() const
|
FilePath FilePath::absolutePath() const
|
||||||
|
Reference in New Issue
Block a user