Changeset View
Changeset View
Standalone View
Standalone View
src/lib/util/kshell.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 62 | if (!ret.isNull()) { | |||
---|---|---|---|---|---|
63 | ret += fname.midRef(pos); | 63 | ret += fname.midRef(pos); | ||
64 | } | 64 | } | ||
65 | return ret; | 65 | return ret; | ||
66 | } else if (fname.length() > 1 && fname[0] == QLatin1Char(ESCAPE) && fname[1] == QLatin1Char('~')) { | 66 | } else if (fname.length() > 1 && fname[0] == QLatin1Char(ESCAPE) && fname[1] == QLatin1Char('~')) { | ||
67 | return fname.mid(1); | 67 | return fname.mid(1); | ||
68 | } | 68 | } | ||
69 | return fname; | 69 | return fname; | ||
70 | } | 70 | } | ||
71 | | ||||
72 | QString KShell::tildeCollapse(const QString &path) | ||||
73 | { | ||||
74 | if (!path.isEmpty()) { | ||||
75 | const auto homePath = QDir::homePath(); | ||||
76 | if (path.startsWith(homePath)) { | ||||
77 | auto newPath = path; | ||||
78 | newPath.replace(0, homePath.length(), QLatin1Char('~')); | ||||
79 | return newPath; | ||||
80 | } | ||||
81 | } | ||||
82 | return path; | ||||
83 | } |