forked from qt-creator/qt-creator
ProjectExplorer: Show near paths as relative
Previously if a path was not a child of the directory it was inserted into it would be displayed as an absolute path. This changes it to show it relative with ".." as long as there are no more than 5 "../"'s. Fixes: QTCREATORBUG-288 Change-Id: I456138e97298d58ac6d95e69443c8e187fb8782c Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -52,9 +52,15 @@ static FolderNode *recursiveFindOrCreateFolderNode(FolderNode *folder,
|
||||
isRelative = true;
|
||||
directoryWithoutPrefix = directory.relativeChildPath(path);
|
||||
} else {
|
||||
isRelative = false;
|
||||
path.clear();
|
||||
directoryWithoutPrefix = directory;
|
||||
const FilePath relativePath = directory.relativePathFrom(path);
|
||||
if (relativePath.path().count("../") < 5) {
|
||||
isRelative = true;
|
||||
directoryWithoutPrefix = relativePath;
|
||||
} else {
|
||||
isRelative = false;
|
||||
path.clear();
|
||||
directoryWithoutPrefix = directory;
|
||||
}
|
||||
}
|
||||
}
|
||||
QStringList parts = directoryWithoutPrefix.path().split('/', Qt::SkipEmptyParts);
|
||||
|
Reference in New Issue
Block a user