Skip to contentSkip to conversation

plugins/org.yocto.sdk.ide: Account for multiple PATH exports

PATCH New Adrian Dudau 1 participant 1 message May 31, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 plugins/org.yocto.sdk.ide: Account for multiple PATH exports

In the current implementation of the HashMap parsing of the source script only the last $PATH export is considered, which leads to issues in the case of eSDK.

By concatenating the new value with HashMap values from previous iterations we make sure that previous exports are not lost.

[YOCTO #9361]

---
 .../src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java                 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
plugins/org.yocto.sdk.ide/src/org/yocto/sdk/ide/utils/YoctoSDKUtils.java +5 -2
index 6afc185..5fe74a5 100644
@@ -223,9 +223,12 @@ public class YoctoSDKUtils {
 						if (sValue.startsWith("\"") && sValue.endsWith("\""))
 							sValue = sValue.substring(sValue.indexOf('"') + 1, sValue.lastIndexOf('"'));
 						/* If PATH ending with $PATH, we need to join with current system path */
-						if (sKey.equalsIgnoreCase("PATH")) {
-							if (sValue.lastIndexOf("$PATH") >= 0)
+						if (sKey.equalsIgnoreCase("PATH") && (sValue.lastIndexOf("$PATH") >= 0)) {
+							if (envMap.containsKey(sKey)) {
+								sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + envMap.get(sKey);
+							} else {
 								sValue = sValue.substring(0, sValue.lastIndexOf("$PATH")) + System.getenv("PATH");
+							}
 						}
 
 						if(sValue.toUpperCase().contains("$SDKTARGETSYSROOT")) {
Signature · 1 line
1.9.1