Skip to content

Commit 6dfe0aa

Browse files
committed
fix: avoiding duplicate PATH variable
1 parent baeb8a5 commit 6dfe0aa

File tree

1 file changed

+8
-2
lines changed
  • bundles/com.espressif.idf.core/src/com/espressif/idf/core/util

1 file changed

+8
-2
lines changed

bundles/com.espressif.idf.core/src/com/espressif/idf/core/util/IDFUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,13 @@ public static Map<String, String> getSystemEnv()
900900
env.put(IDFCorePreferenceConstants.IDF_TOOLS_PATH, idfToolsPath);
901901

902902
// Merge Homebrew bin paths into PATH
903-
String existingPath = env.getOrDefault("PATH", ""); //$NON-NLS-1$ //$NON-NLS-2$
903+
String keyPath = "PATH"; //$NON-NLS-1$
904+
String existingPath = env.getOrDefault(keyPath, ""); //$NON-NLS-1$
905+
if (existingPath.isEmpty())
906+
{
907+
keyPath = "Path"; //$NON-NLS-1$
908+
existingPath = env.getOrDefault(keyPath, ""); //$NON-NLS-1$
909+
}
904910
StringBuilder newPath = new StringBuilder();
905911

906912
String[] brewPaths = { "/usr/local/bin", "/opt/homebrew/bin" }; //$NON-NLS-1$ //$NON-NLS-2$
@@ -915,7 +921,7 @@ public static Map<String, String> getSystemEnv()
915921

916922
// Append the original PATH at the end
917923
newPath.append(existingPath);
918-
env.put("PATH", newPath.toString()); //$NON-NLS-1$
924+
env.put(keyPath, newPath.toString()); // $NON-NLS-1$
919925

920926
return env;
921927
}

0 commit comments

Comments
 (0)