forked from qt-creator/qt-creator
Utils: Fix showing of directories in a graphical shell on Linux
In case a directory was passed to FileUtils::showInGraphicalShell, the parent directory was shown in the graphical shell. This fixes it in substituteFileBrowserParameters. Change-Id: Idedd62fabb233b7622561a0e942b1b762513cd6d Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -49,7 +49,10 @@ QString substituteFileBrowserParameters(const QString &pre, const QString &file)
|
|||||||
c = pre.at(++i);
|
c = pre.at(++i);
|
||||||
QString s;
|
QString s;
|
||||||
if (c == QLatin1Char('d')) {
|
if (c == QLatin1Char('d')) {
|
||||||
s = QLatin1Char('"') + QFileInfo(file).path() + QLatin1Char('"');
|
// In case a directory was passed in, use that. In case of a file, the parent dir.
|
||||||
|
const QFileInfo fi(file);
|
||||||
|
const QString folder = fi.isDir() ? fi.filePath() : fi.path();
|
||||||
|
s = QLatin1Char('"') + folder + QLatin1Char('"');
|
||||||
} else if (c == QLatin1Char('f')) {
|
} else if (c == QLatin1Char('f')) {
|
||||||
s = QLatin1Char('"') + file + QLatin1Char('"');
|
s = QLatin1Char('"') + file + QLatin1Char('"');
|
||||||
} else if (c == QLatin1Char('n')) {
|
} else if (c == QLatin1Char('n')) {
|
||||||
|
Reference in New Issue
Block a user