Utils: Fix error prone default value of appendOrSet

It was not readily clear that Environment::appendOrSet/prependOrSet
needed a value for "sep", otherwise it would just concat the values without separator. This got apparent when looking at usages of
appendOrSet.

Instead there are now three options, "Auto", "Colon" or "Semicolon"
with the default being "Auto", which determines the separator based on
the Environment::OsType.

Usages of appendOrSet and prependOrSet are also fixed with this commit.

Change-Id: I868e14ce38f50be9cd07292fe3f22663a62d116d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-01-26 10:33:29 +01:00
parent 56f42c319e
commit a25bbf23c6
11 changed files with 70 additions and 71 deletions

View File

@@ -109,15 +109,11 @@ protected:
Environment env = python.deviceEnvironment();
const FilePath lspPath = pyLspPath(python);
if (!lspPath.isEmpty() && lspPath.exists() && QTC_GUARD(lspPath.isSameDevice(python))) {
env.appendOrSet("PYTHONPATH",
lspPath.path(),
OsSpecificAspects::pathListSeparator(env.osType()));
env.appendOrSet("PYTHONPATH", lspPath.path());
}
if (!python.needsDevice()) {
// todo check where to put this tempdir in remote setups
env.appendOrSet("PYTHONPATH",
m_extraPythonPath.path().toString(),
OsSpecificAspects::pathListSeparator(env.osType()));
env.appendOrSet("PYTHONPATH", m_extraPythonPath.path().toString());
}
if (env.hasChanges())
setEnvironment(env);