Commit 6639acb7 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Handle %D in tab format when process's home dir is not found (eg sudo)

Replace %D with - in such cases where process's home dir is empty

BUG: 390896
parent 1530548a
......@@ -1075,14 +1075,19 @@ QString Session::getDynamicTitle()
}
if (title.contains(QLatin1String("%D"))) {
QString homeDir = process->userHomeDir();
QString tempDir = dir;
// Change User's Home Dir w/ ~ only at the beginning
if (tempDir.startsWith(homeDir)) {
tempDir.remove(0, homeDir.length());
tempDir.prepend(QLatin1Char('~'));
const QString homeDir = process->userHomeDir();
if (!homeDir.isEmpty()) {
QString tempDir = dir;
// Change User's Home Dir w/ ~ only at the beginning
if (tempDir.startsWith(homeDir)) {
tempDir.remove(0, homeDir.length());
tempDir.prepend(QLatin1Char('~'));
}
title.replace(QLatin1String("%D"), tempDir);
} else {
// Example: 'sudo top' We have to replace %D with something
title.replace(QLatin1String("%D"), QStringLiteral("-"));
}
title.replace(QLatin1String("%D"), tempDir);
}
title.replace(QLatin1String("%d"), process->formatShortDir(dir));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment