Substitute tilde with USERPROFILE on Windows
The substitution is now more shell-like and tilde is only replaced from the beginning of the path if it is trailed by a slash.
This commit is contained in:
committed by
Jonathan White
parent
005d9d368f
commit
7c39907251
@@ -331,11 +331,15 @@ namespace Tools
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QRegularExpression varRe("\\%([A-Za-z][A-Za-z0-9_]*)\\%");
|
||||
QString homeEnv = "USERPROFILE";
|
||||
#else
|
||||
QRegularExpression varRe("\\$([A-Za-z][A-Za-z0-9_]*)");
|
||||
subbed.replace("~", environment.value("HOME"));
|
||||
QString homeEnv = "HOME";
|
||||
#endif
|
||||
|
||||
if (subbed.startsWith("~/") || subbed.startsWith("~\\"))
|
||||
subbed.replace(0, 1, environment.value(homeEnv));
|
||||
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user