in rake-runner-agent/src/jetbrains/buildServer/agent/rakerunner/utils/OSUtil.java [75:105]
private static void mergeWithEnvVariable(final boolean append,
@NotNull final String additionalValue,
@NotNull final String separator,
@NotNull final String variableName,
@NotNull final Map<String, String> envMap,
final boolean convertToSystemDependent,
final boolean convertToSystemInDependent) {
if (convertToSystemDependent && convertToSystemInDependent) {
throw new IllegalArgumentException("Convert to system dependent and independent cant be both true.");
}
final String oldValue = envMap.get(variableName);
final String mergedValue;
if (StringUtil.isEmpty(oldValue)) {
mergedValue = additionalValue;
} else {
mergedValue = append ? oldValue + separator + additionalValue
: additionalValue + separator + oldValue;
}
String newValue = mergedValue;
if (convertToSystemDependent) {
newValue = toSystemDependentName(mergedValue);
}
if (convertToSystemInDependent) {
newValue = toSystemIndependentName(mergedValue);
}
envMap.put(variableName, newValue);
}