forked from qt-creator/qt-creator
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:
@@ -139,10 +139,8 @@ void expand(const PresetType &preset, Environment &env, const FilePath &sourceDi
|
||||
return presetEnv.value(macroName);
|
||||
});
|
||||
|
||||
QString sep;
|
||||
bool append = true;
|
||||
if (key.compare("PATH", Qt::CaseInsensitive) == 0) {
|
||||
sep = OsSpecificAspects::pathListSeparator(env.osType());
|
||||
const int index = value.indexOf("$penv{PATH}", 0, Qt::CaseInsensitive);
|
||||
if (index != 0)
|
||||
append = false;
|
||||
@@ -157,9 +155,9 @@ void expand(const PresetType &preset, Environment &env, const FilePath &sourceDi
|
||||
expandAllButEnv(preset, sourceDirectory, value);
|
||||
|
||||
if (append)
|
||||
env.appendOrSet(key, value, sep);
|
||||
env.appendOrSet(key, value);
|
||||
else
|
||||
env.prependOrSet(key, value, sep);
|
||||
env.prependOrSet(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user